New Random Number Generator

Tim Rowledge tim at sumeru.stanford.edu
Tue Jul 30 20:10:41 UTC 2002


Mark4Flies at aol.com is claimed by the authorities to have written:


> << To check further, knock up a little C prog to take a few numbers and do
> the various shifts/masks, and some Squeak code to do the same. Compare;
> it should at least illustrate where the differences are creeping in ot
> bite you. Chances are good that it is a single trivial typo-like error
> somewhere. >>
> 
> Thank you for the advice but now I suspect that it is probably not a 
> typographical error (confirmed original C source) but a subtle difference in 
> the behavior between Smalltalk and C when it comes to long unsigned integer 
> operations. I just have no clue!
Actually in this part I was suggesting that it might be a simple typo in
the _smalltalk_ and that by comparing the results of the shifts & masks
in C with those in Smalltalk you could probably find out something.

I'm just looking at making a little plugin of it and wondering which of
the varieties of numbers one really wants. The C file I downloaded seems
to offer:-
array initialisation of seeds
plain init of seeds
32 bit int result 0 to 16rFFFFFFFF
31 bit 0 to 16r7FFFFFFF
three different reals, [0,1], [0,1), (0,1) and [0,1) 53 bit resolution.

Obviously the simplest would be to drop everything but the plain init
and 32 bit int result.  One might reasonably cut it to 30bit positive
SmallInteger results.

What would be most useful? 

 tim
-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
When flying iverted, remember that down is up and up is expensive




More information about the Squeak-dev mailing list