[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 30 Apr 2003 21:10:51 -0000


albertel		Wed Apr 30 17:10:51 2003 EDT

  Modified files:              
    /loncom/homework	default_homework.lcpm 
  Log:
  - understadns new rndseed returns
  
  
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.60 loncom/homework/default_homework.lcpm:1.61
--- loncom/homework/default_homework.lcpm:1.60	Tue Mar 25 18:05:03 2003
+++ loncom/homework/default_homework.lcpm	Wed Apr 30 17:10:50 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
 #
-# $Id: default_homework.lcpm,v 1.60 2003/03/25 23:05:03 albertel Exp $
+# $Id: default_homework.lcpm,v 1.61 2003/04/30 21:10:50 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -82,7 +82,7 @@
   #formula type setup the sample points
   if ($type eq '8') {
     ($id_list,$points)=split(/@/,$samples);
-    $message.="Found :$points: points\n";
+    $message.="Found :$id_list:$points: points in $samples\n";
   }
   if ($tol eq '') {
     $tol=0.0;
@@ -238,17 +238,22 @@
 }
 
 sub random {
-  my ($start,$end,$step)=@_;
-  if ( ! $hidden::RANDOMINIT ) {
-    if ($external::randomseed == 0) { $external::randomseed=1; }
-    &random_set_seed(1,int(abs($external::randomseed)));
-    &math_random_uniform();
-    $hidden::RANDOMINIT=1;
-  }
-  if (!defined($step)) { $step=1; }
-  my $num=1+int(($end-$start)/$step);
-  my $result=$start + int(&math_random_uniform() * $num)*$step;
-  return $result;
+    my ($start,$end,$step)=@_;
+    if ( ! $hidden::RANDOMINIT ) {
+	if ($external::randomseed == 0) { $external::randomseed=1; }
+	if ($external::randomseed =~/,/) {
+	    my ($num1,$num2)=split(/,/,$seed);
+	    &random_set_seed(abs($num1),abs($num2));
+	} else {
+	    &random_set_seed(1,int(abs($external::randomseed)));
+	}
+	&math_random_uniform();
+	$hidden::RANDOMINIT=1;
+    }
+    if (!defined($step)) { $step=1; }
+    my $num=1+int(($end-$start)/$step);
+    my $result=$start + int(&math_random_uniform() * $num)*$step;
+    return $result;
 }
 
 sub random_normal {