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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 07 Dec 2004 23:23:34 -0000


albertel		Tue Dec  7 18:23:34 2004 EDT

  Modified files:              
    /loncom/homework	response.pm 
  Log:
  - somtimes the response id is the only source of 'randomness', BUG#3627
  
  
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.110 loncom/homework/response.pm:1.111
--- loncom/homework/response.pm:1.110	Tue Dec  7 11:19:37 2004
+++ loncom/homework/response.pm	Tue Dec  7 18:23:34 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.110 2004/12/07 16:19:37 albertel Exp $
+# $Id: response.pm,v 1.111 2004/12/07 23:23:34 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -132,7 +132,8 @@
     } else {
 	$rndmod=(&Apache::lonnet::numval3($Apache::inputtags::part) << 10);
 	if (defined($Apache::inputtags::response[-1])) {
-	    $rndmod+=&Apache::lonnet::numval3($Apache::inputtags::response[-1]);
+	    my $shift=(4*scalar(@Apache::inputtags::response))%20;
+	    $rndmod+=(&Apache::lonnet::numval3($Apache::inputtags::response[-1]) << $shift );
 	}
     }
     if ($rndseed =~/([,:])/) {
@@ -150,7 +151,7 @@
 	    $rndseed=(($rndseed<<32)>>32);
 	}
     }
-    &Apache::lonxml::debug("randseed $rndseed");
+    &Apache::lonxml::debug("randseed $rndmod $rndseed");
     &Apache::lonnet::setup_random_from_rndseed($rndseed);
     return '';
 }