RFC - Mersenne Twister (SFMT)

Tyro[a.c.edwards] no at spam.com
Sun Nov 18 04:09:30 PST 2007


Bill Baxter さんは書きました:
> Tyro[a.c.edwards] wrote:
>> After reading Julienne Walker's article 
>> (http://www.eternallyconfuzzled.com/arts/jsw_art_rand.aspx) on rand() 
>> I wondered why the very best psudo-random generator available is not 
>> the standard. I looked at the std.random and was not happy to find out 
>> that it is slower than I rand() so I attempted to convert Mersenne 
>> Twister (again). I'm hoping to get some feedback on how to improve 
>> upon the attempt. The actual library 
>> (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html) 
>> comes with code for both 64-bit OSes and more.
>>
>> D version: D v2.007
>> OS: Windows XP - sp2
>>
>> Thanks,
>> Andrew
> 
> It looks nice.
> 
> Not sure what kind of feedback you were after, but I get the feeling 
> that there are a lot of functions there for internal use only.  Those 
> should probably be flagged private to help make it clearer what the 
> actual user interface is.
> 
> Also it's nice to give it a module declaration with a doc comment before 
> that that explains what the module is for and the basics of how to use it.
> 
> You might also want to provide a class version of the algorithm which 
> encapsulates the state, to make thread safety easier.  But it's nice to 
> retain the  global-state function-based version, since it's a little 
> easier to work with when you don't actually need thread safety.
> 
> If that's not the kind of feedback you were after then my apologies.
> 
> --bb

Thanks --bb, in posting this, I'm was hoping for anyting advice I could 
get towards improving it and probably so help with the 64bit portion. 
This qualifies as advice and I'm very greatful.

Andrew


More information about the Digitalmars-d-learn mailing list