[Newbies] Re: What's wrong with this statement?
Timothy J Miller
tmiller at mitre.org
Thu Jul 31 20:35:36 UTC 2008
On Jul 31, 2008, at 3:01 PM, nicolas cellier wrote:
> Random>>#next uses Floating point arithmetic.
> Thus you get the 53 bits precision of a Float mantissa (IEEE 754
> It then gets shifted (128-53) times.
> There's probably a trick that rounds Float last bit to zero
> (like round to nearest integer always occur).
> And you might be able to understand the trailing 1.
> Worse, the default Random generator does a modulo (2 raisdeTo: 31) -
> That is, it can generate at most (2 raisdeTo: 31) different numbers...
> That happens to be the number of SmallInteger in the system, so it
> works better for SmallIntegers.
> A different strategy should be adopted for
> Let us say current implementation is very limited...
> I suggest you open a mantis account and report the issue at http://bugs.squeak.org
First I'll dig into the Cryptography package and see what they did for
large random numbers.
It certainly is inconsistent to have an Integer method that doesn't
invisibly handle large ints.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2533 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080731/cee7a43c/smime.bin
More information about the Beginners