[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Thu Jun 12 23:33:55 EDT 2014


raeburn		Fri Jun 13 03:33:55 2014 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Check that both args to be passed to &Math::Random::random_set_seed() 
    are within bounds.  If either is out of bounds fall back to using
    &Math::Random::random_set_seed_from_phrase() instead.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1261 loncom/lonnet/perl/lonnet.pm:1.1262
--- loncom/lonnet/perl/lonnet.pm:1.1261	Thu May 29 12:45:05 2014
+++ loncom/lonnet/perl/lonnet.pm	Fri Jun 13 03:33:55 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1261 2014/05/29 12:45:05 raeburn Exp $
+# $Id: lonnet.pm,v 1.1262 2014/06/13 03:33:55 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -11281,8 +11281,12 @@
 sub setup_random_from_rndseed {
     my ($rndseed)=@_;
     if ($rndseed =~/([,:])/) {
-	my ($num1,$num2)=split(/[,:]/,$rndseed);
-	&Math::Random::random_set_seed(abs($num1),abs($num2));
+        my ($num1,$num2) = map { abs($_); } (split(/[,:]/,$rndseed));
+        if ((!$num1) || (!$num2) || ($num1 > 2147483562) || ($num2 > 2147483398)) {
+            &Math::Random::random_set_seed_from_phrase($rndseed);
+        } else {
+            &Math::Random::random_set_seed($num1,$num2);
+        }
     } else {
 	&Math::Random::random_set_seed_from_phrase($rndseed);
     }




More information about the LON-CAPA-cvs mailing list