[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm lonhomework.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 13 Nov 2002 23:05:46 -0000
albertel Wed Nov 13 18:05:46 2002 EDT
Modified files:
/loncom/homework lonhomework.pm default_homework.lcpm
Log:
- better distribution of random numbers
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.101 loncom/homework/lonhomework.pm:1.102
--- loncom/homework/lonhomework.pm:1.101 Tue Nov 12 00:05:26 2002
+++ loncom/homework/lonhomework.pm Wed Nov 13 18:05:46 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.101 2002/11/12 05:05:26 albertel Exp $
+# $Id: lonhomework.pm,v 1.102 2002/11/13 23:05:46 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -332,13 +332,12 @@
my %overall;
my %allparts;
my $rndseed=$ENV{'form.rndseed'};
- srand($rndseed);
&analyze_header($request);
- for(my $i;$i<$ENV{'form.numtoanalyze'};$i++) {
+ for(my $i=1;$i<$ENV{'form.numtoanalyze'}+1;$i++) {
my $subresult=&Apache::lonnet::ssi($request->uri,
('grade_target' => 'analyze'),
- ('rndseed' => rand));
- #&Apache::lonxml::debug(":$subresult:");
+ ('rndseed' => $i));
+ &Apache::lonxml::debug(":$subresult:");
(my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2);
my %analyze=&Apache::lonnet::str2hash($subresult);
&Apache::lonhomework::showhash(%analyze);
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.53 loncom/homework/default_homework.lcpm:1.54
--- loncom/homework/default_homework.lcpm:1.53 Thu Sep 26 17:54:00 2002
+++ loncom/homework/default_homework.lcpm Wed Nov 13 18:05:46 2002
@@ -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.53 2002/09/26 21:54:00 albertel Exp $
+# $Id: default_homework.lcpm,v 1.54 2002/11/13 23:05:46 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -240,7 +240,8 @@
sub random {
my ($start,$end,$step)=@_;
if ( ! $hidden::RANDOMINIT ) {
- &random_set_seed_from_phrase($external::randomseed);
+ &random_set_seed(1,$external::randomseed);
+ &math_random_uniform();
$hidden::RANDOMINIT=1;
}
if (!defined($step)) { $step=1; }