[BUG] Random access to Collections (#atRandom)

David N. Smith dnsmith at watson.ibm.com
Thu Apr 19 19:29:49 UTC 2001


Hi:

There is a bug in Collection>>#atRandom, or rather with the instance of Random used by it.

Collection class>>#initialize gets a random number generator and saves it for use by #atRandom (and a few others). It does NOT reinitialize at system startup time, so an image keeps the same random number generator across saves and restarts. 

In a development image this is not much of a problem, if indeed it is a problem, but in package images it is. I discovered, while stepping through a program with someone on the phone, that the program was picking the same random numbers. I tracked it down to Collection, which is the only place the program does randomness.

I've worked around the problem, but it should be fixed so that each image starts up with a fresh, or reseeded, random number generator in Collection. It makes a big difference in packaged images.

Dave
-- 
_______________________________
David N. Smith
IBM T J Watson Research Center
Hawthorne, NY
_______________________________
Any opinions or recommendations
herein are those of the author  
and not of his employer.





More information about the Squeak-dev mailing list