Peter Smet peter.smet at
Wed Oct 7 05:53:14 UTC 1998

I love the way Squeak uses the random number generator in the collection
This hugely simplifies a lot of things. I have run into some portability
issues with
this, however. Squeak uses truncation for 'asInteger', Dolphin uses
This can make a big difference. Does anyone know what the ANSI standard
for 'asInteger' should be? Regardless of this, I think it may be less
to use 'truncated' rather than asInteger.

 index :=  (aGenerator next * self size) asInteger + 1.

 index :=  (aGenerator next * self size) truncated + 1.

The other thing I noticed is that atRandom and atRandom: aRNG duplicate
a lot of code. Why not implement atRandom as this:

   ^self atRandom: RandomForPicking


More information about the Squeak-dev mailing list