[LON-CAPA-cvs] cvs: loncom /homework response.pm structuretags.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 03 Nov 2003 21:47:21 -0000
albertel Mon Nov 3 16:47:21 2003 EDT
Modified files:
/loncom/homework response.pm structuretags.pm
Log:
- Secondary randomizers (foil order etc) wasn't using proper method to get seed when playing with public versions of problems (BUG#2348)
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.87 loncom/homework/response.pm:1.88
--- loncom/homework/response.pm:1.87 Mon Oct 27 14:27:09 2003
+++ loncom/homework/response.pm Mon Nov 3 16:47:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.87 2003/10/27 19:27:09 albertel Exp $
+# $Id: response.pm,v 1.88 2003/11/03 21:47:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -77,17 +77,13 @@
# that is stable and unique based on the part number and response number
sub setrandomnumber {
my $rndseed;
- if ($ENV{'request.state'} eq "construct") {
- $rndseed=$ENV{'form.rndseed'};
- if (!$rndseed) { $rndseed=time; }
- } else {
- $rndseed=&Apache::lonnet::rndseed();
- }
+ $rndseed=&Apache::structuretags::setup_rndseed();
+ if (!defined($rndseed)) { $rndseed=&Apache::lonnet::rndseed(); }
&Apache::lonxml::debug("randseed $rndseed");
# $rndseed=unpack("%32i",$rndseed);
my $rndmod=(&Apache::lonnet::numval($Apache::inputtags::part) << 10);
if (defined($Apache::inputtags::response['-1'])) {
- $rndmod+=&Apache::lonnet::numval($Apache::inputtags::response[-1]);
+ $rndmod+=&Apache::lonnet::numval($Apache::inputtags::response[-1]);
}
if ($rndseed =~/,/) {
{
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.220 loncom/homework/structuretags.pm:1.221
--- loncom/homework/structuretags.pm:1.220 Sat Nov 1 11:37:21 2003
+++ loncom/homework/structuretags.pm Mon Nov 3 16:47:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.220 2003/11/01 16:37:21 www Exp $
+# $Id: structuretags.pm,v 1.221 2003/11/03 21:47:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -171,8 +171,10 @@
if (defined($rndseed) && $rndseed ne int($rndseed)) {
$rndseed=join(',',&Math::Random::random_seed_from_phrase($rndseed));
}
- &Apache::lonxml::debug("Setting rndseed to $rndseed");
- &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval);
+ if ($safeeval) {
+ &Apache::lonxml::debug("Setting rndseed to $rndseed");
+ &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval);
+ }
}
return $rndseed;
}