--- loncom/interface/lonprintout.pm	2003/09/05 19:42:00	1.229
+++ loncom/interface/lonprintout.pm	2003/09/06 17:21:16	1.230
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.229 2003/09/05 19:42:00 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.230 2003/09/06 17:21:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -670,6 +670,9 @@ ENDPART
 	    $form{'problem_split'}=$parmhash{'problem_stream_switch'};
 	    $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
 	    my $rndseed=time;
+	    if ($helper->{'VARS'}->{'curseed'}) {
+		$rndseed=$helper->{'VARS'}->{'curseed'};
+	    }
 	    $form{'rndseed'}=$rndseed;
 	    &Apache::lonnet::appenv(%moreenv);
 	    &Apache::lonnet::delenv('form.counter');
@@ -884,6 +887,9 @@ ENDPART
 	@list_of_files=sort @list_of_files;
 	my $flag_latex_header_remove = 'NO'; 
 	my $rndseed=time;
+	if ($helper->{'VARS'}->{'curseed'}) {
+	    $rndseed=$helper->{'VARS'}->{'curseed'};
+	}
 	for (my $i=0;$i<=$#list_of_files;$i++) {
 	    my $urlp = $list_of_files[$i];
 	    if ($urlp=~/\//) {
@@ -1059,6 +1065,7 @@ sub printHelper {
     my $helper = Apache::lonhelper::helper->new("Printing Helper");
     $helper->declareVar('symb');
     $helper->declareVar('postdata');    
+    $helper->declareVar('curseed');    
     $helper->declareVar('filename');
     $helper->declareVar('construction');
     $helper->declareVar('assignment');
@@ -1114,6 +1121,9 @@ sub printHelper {
         }
         $subdir = &Apache::lonnet::filelocation("", $url);
     }
+    if (!$helper->{VARS}->{'curseed'} && $ENV{'form.curseed'}) {
+	$helper->{VARS}->{'curseed'}=$ENV{'form.curseed'};
+    }
 
     my $userCanSeeHidden = Apache::lonnavmaps::advancedUser();
 
@@ -1331,6 +1341,18 @@ CHOOSE_FROM_SUBDIR
 	    Apache::lonhelper::dropdown->new();
 	    addMessage("</td></tr>");
 	}
+	if ($helper->{'VARS'}->{'construction'}) { 
+	    my $xmlfrag .= <<'RNDSEED';
+	    <message><tr><td align='right'>Use random seed: </td><td></message>
+	    <string variable="curseed" size="15" maxlength="15">
+		<defaultvalue>
+	            return $helper->{VARS}->{'curseed'};
+	        </defaultvalue>
+	     </string>
+             <message></td></tr></message>
+RNDSEED
+            &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag);
+	}
     }
 
     if ($startedTable) {