digitalmars.D.announce - Mersienne Twister
- "Derek Parnell" <derek psych.ward> Apr 13 2006
- James Dunne <james.jdunne gmail.com> Apr 13 2006
- "Derek Parnell" <derek psych.ward> Apr 13 2006
- Victor Nakoryakov <nail-mail mail.ru> Apr 13 2006
- "Derek Parnell" <derek psych.ward> Apr 13 2006
- Wang Zhen <nehzgnaw gmail.com> Apr 28 2006
I did a port of the Mersienne Twister (C-language edition) by Takuji
Nishimura and Makoto Matsumoto into D. It is a free function version and
doesn't use any classes. It also has a template for ranged random numbers.
eg..
uint v = genrand_range!(uint)(1, 10));
double f = genrand_range!(double)(-0.5, 0.5))
It can be found at
http://www.users.bigpond.com/ddparnell/mt.d
To get the object file only, compile with
dmd -c mt
to get a stand alone self-test version compile with
dmd -version=main mt
--
Derek Parnell
Melbourne, Australia
Apr 13 2006
Derek Parnell wrote:I did a port of the Mersienne Twister (C-language edition) by Takuji Nishimura and Makoto Matsumoto into D. It is a free function version and doesn't use any classes. It also has a template for ranged random numbers. eg.. uint v = genrand_range!(uint)(1, 10)); double f = genrand_range!(double)(-0.5, 0.5)) It can be found at http://www.users.bigpond.com/ddparnell/mt.d To get the object file only, compile with dmd -c mt to get a stand alone self-test version compile with dmd -version=main mt
Did you get this from Torus Trooper? If not then that's highly coincidental. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O M-- V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e h>--->++ r+++ y+++ ------END GEEK CODE BLOCK------ James Dunne
Apr 13 2006
On Fri, 14 Apr 2006 00:38:42 +1000, James Dunne <james.jdunne gmail.com> wrote:Derek Parnell wrote:I did a port of the Mersienne Twister (C-language edition) by Takuji Nishimura and Makoto Matsumoto into D. It is a free function version and doesn't use any classes. It also has a template for ranged random numbers. eg.. uint v = genrand_range!(uint)(1, 10)); double f = genrand_range!(double)(-0.5, 0.5)) It can be found at http://www.users.bigpond.com/ddparnell/mt.d To get the object file only, compile with dmd -c mt to get a stand alone self-test version compile with dmd -version=main mt
Did you get this from Torus Trooper? If not then that's highly coincidental.
I got it from Makoto's RNG site ... http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html -- Derek Parnell Melbourne, Australia
Apr 13 2006
Derek Parnell wrote:I did a port of the Mersienne Twister (C-language edition) by Takuji Nishimura and Makoto Matsumoto into D. It is a free function version and doesn't use any classes. It also has a template for ranged random numbers. eg.. uint v = genrand_range!(uint)(1, 10)); double f = genrand_range!(double)(-0.5, 0.5)) It can be found at http://www.users.bigpond.com/ddparnell/mt.d To get the object file only, compile with dmd -c mt to get a stand alone self-test version compile with dmd -version=main mt
Hey... I've already implement it in 'helix' on dsource. It is in svn. I'll test your implementation on weekend to see which is faster :) -- Victor (aka nail) Nakoryakov nail-mail<at>mail<dot>ru Krasnoznamensk, Moscow, Russia
Apr 13 2006
On Fri, 14 Apr 2006 01:43:04 +1000, Victor Nakoryakov <nail-mail mail.ru> wrote:Derek Parnell wrote:I did a port of the Mersienne Twister (C-language edition) by Takuji Nishimura and Makoto Matsumoto into D. It is a free function version and doesn't use any classes. It also has a template for ranged random numbers. eg.. uint v = genrand_range!(uint)(1, 10)); double f = genrand_range!(double)(-0.5, 0.5)) It can be found at http://www.users.bigpond.com/ddparnell/mt.d To get the object file only, compile with dmd -c mt to get a stand alone self-test version compile with dmd -version=main mt
Hey... I've already implement it in 'helix' on dsource. It is in svn. I'll test your implementation on weekend to see which is faster :)
Knock yourself out ;-) I haven't bothered tuning it, just made it more D-like. -- Derek Parnell Melbourne, Australia
Apr 13 2006
Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Derek Parnell wrote:I did a port of the Mersienne Twister (C-language edition) by Takuji Nishimura and Makoto Matsumoto into D. It is a free function version and doesn't use any classes. It also has a template for ranged random numbers. eg.. uint v = genrand_range!(uint)(1, 10)); double f = genrand_range!(double)(-0.5, 0.5)) It can be found at http://www.users.bigpond.com/ddparnell/mt.d To get the object file only, compile with dmd -c mt to get a stand alone self-test version compile with dmd -version=main mt --Derek Parnell Melbourne, Australia
Attached is my D port of MT19937. I sent it to Walter last April as a proposed replacement for std.random.
Apr 28 2006









"Derek Parnell" <derek psych.ward> 