Mersienne Twister

Derek Parnell derek at psych.ward
Thu Apr 13 10:28:22 PDT 2006


On Fri, 14 Apr 2006 01:43:04 +1000, Victor Nakoryakov <nail-mail at 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



More information about the Digitalmars-d-announce mailing list