--- loncom/homework/structuretags.pm 2004/04/29 07:57:47 1.246 +++ loncom/homework/structuretags.pm 2004/05/04 19:32:28 1.247 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.246 2004/04/29 07:57:47 albertel Exp $ +# $Id: structuretags.pm,v 1.247 2004/05/04 19:32:28 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -153,7 +153,8 @@ sub setup_rndseed { my ($safeeval)=@_; my $rndseed; my ($symb)=&Apache::lonxml::whichuser(); - if ($ENV{'request.state'} eq "construct" || $symb eq '') { + if ($ENV{'request.state'} eq "construct" || $symb eq '' || + $Apache::lonhomework::history{'resource.CODE'}) { $rndseed=$ENV{'form.rndseed'}; if (!$rndseed) { $rndseed=$Apache::lonhomework::history{'rndseed'}; @@ -173,6 +174,9 @@ sub setup_rndseed { if (defined($rndseed) && $rndseed ne int($rndseed)) { $rndseed=join(',',&Math::Random::random_seed_from_phrase($rndseed)); } + if ($Apache::lonhomework::history{'resource.CODE'}) { + $rndseed=&Apache::lonnet::rndseed(); + } if ($safeeval) { &Apache::lonxml::debug("Setting rndseed to $rndseed"); &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval);