[LON-CAPA-cvs] cvs: loncom /xml lonplot.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 14 Mar 2002 19:02:31 -0000


albertel		Thu Mar 14 14:02:31 2002 EDT

  Modified files:              
    /loncom/xml	lonplot.pm 
  Log:
  - the rand call was screwing up grade and answer mode parses BUG #190
  
  
Index: loncom/xml/lonplot.pm
diff -u loncom/xml/lonplot.pm:1.55 loncom/xml/lonplot.pm:1.56
--- loncom/xml/lonplot.pm:1.55	Wed Mar  6 14:55:30 2002
+++ loncom/xml/lonplot.pm	Thu Mar 14 14:02:30 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Dynamic plot
 #
-# $Id: lonplot.pm,v 1.55 2002/03/06 19:55:30 matthew Exp $
+# $Id: lonplot.pm,v 1.56 2002/03/14 19:02:30 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -443,13 +443,21 @@
     &Apache::lonxml::deregister('Apache::lonplot',
 	('title','xlabel','ylabel','key','axis','label','curve'));
     my $result = '';
+    my $randnumber;
+    # need to call rand everytime start_script would evaluate, as the
+    # safe space rand number generator and the global rand generator 
+    # are not seperate
+    if ($target eq 'web' || $target eq 'tex' || $target eq 'grade' ||
+	$target eq 'answer') {
+      $randnumber=int(rand(1000));
+    }
     if ($target eq 'web' || $target eq 'tex') {
 	&check_inputs(); # Make sure we have all the data we need
 	##
 	## Determine filename
 	my $tmpdir = '/home/httpd/perl/tmp/';
 	my $filename = $ENV{'user.name'}.'_'.$ENV{'user.domain'}.
-	    '_'.time.'_'.$$.int(rand(1000)).'_plot.data';
+	    '_'.time.'_'.$$.$randnumber.'_plot.data';
 	## Write the plot description to the file
 	&write_gnuplot_file($tmpdir,$filename,$target);
 	$filename = &Apache::lonnet::escape($filename);