New Random Number Generator
Mark4Flies at aol.com
Mark4Flies at aol.com
Wed Jul 31 18:48:43 UTC 2002
<< 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. >>
Oh! Now I understand. All I can tell you is that I actually took the C code
and pasted it, verbatim, into the first Smalltalk method. Since this stuff is
mostly bit operations, I only had to replace C tokens like '^' with 'bitXOr:'
and so on. This approach was an attempt to avoid typographical errors up
front.
Since then I have poured over the C and Smalltalk code in parallel and just
can't find a single discrepency. Then again, the hardest task is to find
fault in one's own work...
<< 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. >>
I am new to the idea of plugins. I suspect that they are a mechanism to take
a foreign code (like these C programs), in whole or in part, and encapsulate
it with a Smalltalk interface. Yes?
<< What would be most useful? >>
I really appreciate your help on this problem but I honestly do not have a
clue how to answer this question.
-Mark
More information about the Squeak-dev
mailing list
|