Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
April 13, 2006 Mersienne Twister | ||||
---|---|---|---|---|
| ||||
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 |
April 13, 2006 Re: Mersienne Twister | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | 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 |
April 13, 2006 Re: Mersienne Twister | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | 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 |
April 13, 2006 Re: Mersienne Twister | ||||
---|---|---|---|---|
| ||||
Posted in reply to James Dunne | 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 |
April 13, 2006 Re: Mersienne Twister | ||||
---|---|---|---|---|
| ||||
Posted in reply to Victor Nakoryakov | 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 |
April 28, 2006 Re: Mersienne Twister | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell Attachments: | 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.
|
Copyright © 1999-2021 by the D Language Foundation