home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,603 of 2,978   
   Dr Engelbert Buxbaum to Claudio Cauchi   
   Re: Call-by-Name Delay   
   22 May 05 18:43:47   
   
   From: engelbert_buxbaum@hotmail.com   
      
   Claudio Cauchi wrote:   
      
   >  I have a procedure generateStudent(var stu:student_record); that   
   > fills   
   >  the data   
   >  items in stu with random data. Now I use this procedure in a   
   > for..loop   
   >  to enter   
   >  several random student records in a file of records.   
   >   
   >  for i:=1 to 10 do   
   >  begin   
   >     generateStudent(temp);   
   >     {delay was inserted here}   
   >     write(myFile,temp);   
   >  end;   
   >   
   >  What I get in the file is a list of records containing similar data!!   
   >  I thought it was a problem with my generateStudent procedure but when   
   >  I tested it it was OK. I "solved" the problem by introducing a   
   >  delay(100); in the loop.   
      
   Did you call "randomize" in your GenerateStudent procedure? This   
   function resets the random generator with a value taken from the system   
   clock. It should be called only once at the beginning of a program,   
   after that only "random" should be used. RTFM for details.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca