| Author | Topic: Mersenne Twister PRNG |
---|
| Thomas Braun | Mersenne Twister PRNG
on Fri, 12 Aug 2005 10:46:24 +0200Hi,
as the Mersenne Twister algorithm for producing pseudo random naumbers is
known to be quite good, I thought it would be not such a bad idea to port
this from C to Xbase++
Because I am not very good at the C language and I know that there are some
around here that *are*, I attach the code for peer review (including the
original C code and documentation).
BTW, the original C code can be found on the official MT-website:
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
Ahhmmm... before I forget the code relies on the not-so-well-documented
functions BOR/BAND/BXOR for bitwise boolean operations - if anyone has
plain Xbase++ versions of those functions...
Thomas Braun Mersenne.zip |
| Thomas Braun | Re: Mersenne Twister PRNG
on Fri, 12 Aug 2005 11:05:27 +0200Thomas Braun wrote:
> Because I am not very good at the C language and I know that there are some
> around here that *are*, I attach the code for peer review (including the
> original C code and documentation).
Sorry - the zip file could have been 50% smaller... I forgot to remove the
.exe and .obj files before zipping
Thomas |
| Phil Ide
| Re: Mersenne Twister PRNG
on Fri, 12 Aug 2005 10:12:28 +0100Thomas,
> Ahhmmm... before I forget the code relies on the not-so-well-documented
> functions BOR/BAND/BXOR for bitwise boolean operations - if anyone has
> plain Xbase++ versions of those functions...
You mean like #78 on my site?
Regards,
Phil Ide
*******************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase *
* --------------------------------------- *
* www.xodc.org.uk - openSource Dev-Center *
*******************************************
So what if I am a modem junky? |
| Greg Doran | Re: Mersenne Twister PRNG
on Fri, 12 Aug 2005 16:19:18 +0100Hi Thomas,
Here you are, the program functions MtRand() and SMtRand() were derived
from the Mersenne Twister algorithm MT19937.c; the work of Makoto
Matsumoto and Takuji Nishimura.
All Xbase++ code but not using Phil's #78 Probably much smarter
coding than mine, so I'll pay #78 a visit...
I like the MT algo, however, what I posted in the original "Random()"
thread is much simpler, fast and effective.
Regards, Greg RandDemoMT.prg |
| Thomas Braun | Re: Mersenne Twister PRNG
on Tue, 16 Aug 2005 08:13:17 +0200Greg Doran wrote:
> I like the MT algo, however, what I posted in the original "Random()"
> thread is much simpler, fast and effective.
Greg,
depending on what you need the rendom numbers for, simple may not be what
you need But the MT algorithm is not suitable for real crypto
applications anyway...
Thomas |