Mersenne Twister?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Mersenne Twister?

Andreas.Raab
Hi Folks -

Does anyone know a good (Squeak/Smalltalk) implementation of the
Mersenne Twister? I have a task for which I don't really trust good ol'
Random and would like to use an alternative PRNG instead.

Thanks,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Mersenne Twister?

Brian Rice
For what it's worth, Slate's RandomStream implements the Mersenne  
Twister:
http://slate.tunes.org/repos/main/src/lib/random.slate

On Jan 24, 2006, at 10:59 PM, Andreas Raab wrote:

> Hi Folks -
>
> Does anyone know a good (Squeak/Smalltalk) implementation of the  
> Mersenne Twister? I have a task for which I don't really trust good  
> ol' Random and would like to use an alternative PRNG instead.
>
> Thanks,
>   - Andreas

--
-Brian
http://tunes.org/~water/brice.vcf




PGP.sig (193 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Mersenne Twister?

Andreas.Raab
Cool, thanks.

Cheers,
   - Andreas

Brian Rice wrote:

> For what it's worth, Slate's RandomStream implements the Mersenne  Twister:
> http://slate.tunes.org/repos/main/src/lib/random.slate
>
> On Jan 24, 2006, at 10:59 PM, Andreas Raab wrote:
>
>> Hi Folks -
>>
>> Does anyone know a good (Squeak/Smalltalk) implementation of the  
>> Mersenne Twister? I have a task for which I don't really trust good  
>> ol' Random and would like to use an alternative PRNG instead.
>>
>> Thanks,
>>   - Andreas
>
>
> --
> -Brian
> http://tunes.org/~water/brice.vcf
>
>
> ------------------------------------------------------------------------
>
>


Reply | Threaded
Open this post in threaded view
|

RE: Mersenne Twister?

Hans Baveco
In reply to this post by Andreas.Raab
Hi Andreas,

The attached squeak implementation of the TT800 algorithm (related to MT
it seems, but with a period of 2^800 instead of 2^19937 -1) was send to
the list in 1999, by (the late?) Dave N Smith. Maybe it is of use here?

Hans
 

-----Original Message-----
From: Andreas Raab [mailto:[hidden email]]
Sent: woensdag 25 januari 2006 8:00
To: The general-purpose Squeak developers list
Subject: Mersenne Twister?

Hi Folks -

Does anyone know a good (Squeak/Smalltalk) implementation of the
Mersenne Twister? I have a task for which I don't really trust good ol'
Random and would like to use an alternative PRNG instead.

Thanks,
   - Andreas




Random-TT800.4Nove333pm.cs (14K) Download Attachment
Re TT800 (was RE PRNGs (was Q Project Better performance for LargeIntegers)).txt (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Mersenne Twister?

Andreas.Raab
This is definitely relevant (I'm mostly looking for something with
"large enough" periodicity). Thanks for posting it!

Cheers,
   - Andreas

Baveco, Hans wrote:

> Hi Andreas,
>
> The attached squeak implementation of the TT800 algorithm (related to MT
> it seems, but with a period of 2^800 instead of 2^19937 -1) was send to
> the list in 1999, by (the late?) Dave N Smith. Maybe it is of use here?
>
> Hans
>  
>
> -----Original Message-----
> From: Andreas Raab [mailto:[hidden email]]
> Sent: woensdag 25 januari 2006 8:00
> To: The general-purpose Squeak developers list
> Subject: Mersenne Twister?
>
> Hi Folks -
>
> Does anyone know a good (Squeak/Smalltalk) implementation of the
> Mersenne Twister? I have a task for which I don't really trust good ol'
> Random and would like to use an alternative PRNG instead.
>
> Thanks,
>    - Andreas
>
>
>
> ------------------------------------------------------------------------
>
> Baveco,  Dr. J.M.
> From: David N. Smith (IBM) [[hidden email]]
> Sent: Thursday, November 04, 1999 9:41 PM
> To: [hidden email]
> Subject: Re: TT800 (was RE: PRNGs  (was [Q] Project: Better performance for LargeIntegers))
> 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
>
>
>
> ------------------------------------------------------------------------
>
>