TT800 (was RE: PRNGs (was [Q] Project: Better performance for LargeIntegers))

David N. Smith (IBM) dnsmith at watson.ibm.com
Thu Nov 4 20:41:00 UTC 1999


--============_-1270374434==_============
Content-Type: text/plain; charset="us-ascii" ; format="flowed"


At 14:09 -0500 11/2/99, Jeff Szuhay wrote:
>>At 13:25 -0500 11/2/99, Jeff Szuhay wrote:
>>>...SNIP...
>>>and finally,
>>>
>>>tt800 source code: <http://random.mat.sbg.ac.at/ftp/pub/daa/tt800.c>
>>
>>Jeff:
>>
>>Can you check this link again? I can get to 
>>http://random.mat.sbg.ac.at/ftp/pub but the daa directory is 
>>missing and nothing else seems to have a tt800.c file.
>
>Oops...
>
>change .../daa/...  to ... /data/...
>and the page will appear.

OK, I got it and have converted it to Squeak (with some testing 
assistance from Jeff). The code is attached. It's basically a 
straight conversion from C. It uses, by its nature, 32-bit long 
integers and is slow by a factor of about 30 relative to Squeak's 
Random class.

References and abstracts to the papers are included in the class 
comment. The original C code (less its tiny main program) is in a 
method as a comment. There are class methods that test the generator 
and also assure that it answers the same results as the C version.

This is a good example of why long integers need to be fast, and how 
easy it is to hit that performance brick wall.

If you are using Random, you can try this by changing the class name 
to RandomTT800. The #next method answers the next pseudo-random 
number and #seed: resets the seed. The generator automatically self 
seeds from the millisecond clock.

Dave
--============_-1270374434==_============
Content-Type: text/plain; name="Random-TT800.4Nove333pm.cs"
 ; x-mac-type="65417070"
 ; x-mac-creator="43534F6D"
Content-Disposition: attachment; filename="Random-TT800.4Nove333pm.cs"
Content-Transfer-Encoding: imap_stub

0,800,2,15507,0,

--============_-1270374434==_============
Content-Type: text/plain; charset="us-ascii" ; format="flowed"


_______________________________
David N. Smith
IBM T J Watson Research Center
Hawthorne, NY
_______________________________
Any opinions or recommendations
herein are those of the author
and not of his employer.
--============_-1270374434==_============--





More information about the Squeak-dev mailing list