[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 23 Oct 2003 19:29:24 -0000


albertel		Thu Oct 23 15:29:24 2003 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - need to reset seed so as to not futz with things since the grade pass doesn't make bubbles
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.118 loncom/homework/caparesponse/caparesponse.pm:1.119
--- loncom/homework/caparesponse/caparesponse.pm:1.118	Thu Oct 23 03:54:55 2003
+++ loncom/homework/caparesponse/caparesponse.pm	Thu Oct 23 15:29:24 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.118 2003/10/23 07:54:55 albertel Exp $
+# $Id: caparesponse.pm,v 1.119 2003/10/23 19:29:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -444,7 +444,8 @@
 sub make_numerical_bubbles {
     my ($number_of_bubbles,$target,$answer,$format,$incorrect) =@_;
     my @bubble_values = ();
-    &Apache::lonxml::debug("incorrect is $incorrect");
+    &Apache::lonxml::debug("answer is $answer incorrect is $incorrect");
+    my @oldseed=&Math::Random::random_get_seed();
     if (defined($incorrect) && ref($incorrect)) {
 	&Apache::lonxml::debug("inside ".(scalar(@$incorrect)+1 gt $number_of_bubbles));
 	if (scalar(@$incorrect)+1 >= $number_of_bubbles) {
@@ -454,6 +455,7 @@
 	    @bubble_values=@rand_inc[0..($number_of_bubbles-2)];
 	    @bubble_values=sort {$a <=> $b} (@bubble_values,$answer);
 	    &Apache::lonxml::debug("Answer was :$answer: returning :".$#bubble_values.": whih are :".join(':',@bubble_values));
+	    &Math::Random::random_set_seed(@oldseed);
 	    return @bubble_values;
 	}
 	#FIXME what to do when not enough incorrects specified?
@@ -471,6 +473,7 @@
 					       $format,$target);
 
     }
+    &Math::Random::random_set_seed(@oldseed);
     return @bubble_values;
 }