[BUG] -5 atRandom does bad things

David N. Smith (IBM) dnsmith at watson.ibm.com
Sun Aug 26 22:46:39 UTC 2001


Hi:

Try:

(1 to: 100) collect: [ :n | -5 atRandom ]

and you get something like this:

#(-3 -1 -3 -2 -2 0 1 1 -3 0 -1 -1 1 1 1 0 1 -2 0 1 -2 0 0 -3 1 1 -3 1 1 1 0 0 -3 1 -2 1 -1 0 -3 -2 -3 -1 0 -1 0 -1 -3 0 -2 -2 -3 -3 -3 -2 -2 0 1 -1 1 -2 -2 -3 -2 0 -2 1 -1 -3 1 0 -3 0 0 1 -1 -2 -3 -2 -3 0 -3 0 0 -3 1 -2 0 0 -3 -2 -3 -1 0 0 -2 -3 -1 -2 -2 1)

Note that the range is -3 to 1. Note also that the comments indicate that this is an invalid use of atRandom. A fix is attached.

Dave
-------------- next part --------------
Skipped content of type multipart/appledouble


More information about the Squeak-dev mailing list