More on Random

Pat Caudill patc at Telepor.com
Fri Jun 11 22:26:27 UTC 1999


>Doesn't this initialize the seed to 0 if
>
>(Time millisecondClockValue bitAnd: 16r3FFFFFFF) = (self hash + 1)?
>
>That is, I think you need to bind the #bitXor: tighter than the #+, as
>in:
>
>	seed := ((Time millisecondClockValue bitAnd: 16r3FFFFFFF)
>			bitXor: self hash) + 1.
>
>W


You cant win if the time is, ferinstance,  16r55555555 and the hash is 
16rAAAAAAAA then your expression will be zero. (very unlikely but... :-). 
If you really want to be safe you will have to put in an explicit test 
for zero.

Pat Caudill





More information about the Squeak-dev mailing list