More on Random
Tom Burns
tburns at appnet.net
Fri Jun 11 21:28:04 UTC 1999
[...]
> Anyhow, how about this:
>
> seed := (Time millisecondClockValue bitAnd: 16r3FFFFFFF)
> bitXor: self hash + 1.
>
> The #bitAnd: assures that the clock value is less than the
> value 'm' and removes dependencies on the maximum clock value; it might
> change some day! The #bitXor: assures that the result is not zero, and
the
> addition of 1 assures against self hash answering zero. Most of this is
> paranoia, but then that's a disease old programmers get!
>
> Anyone see anything I missed?
Well, if the max clock value might change, so might the max SmallInteger
value, so perhaps one should use "SmallInteger maxVal" rather than
16r3FFFFFFF. :-)
t
--
Tom Burns -- tburns at appnet.net -- http://www.aisys.com
AppNet Midwest -- http://www.appnet.net
More information about the Squeak-dev
mailing list
|