digitalmars.D.learn - RFC - Mersenne Twister (SFMT)
- Tyro[a.c.edwards] (5/5) Nov 17 2007 After reading Julienne Walker's article (http://www.eternallyconfuzzled....
- Jason House (3/18) Nov 17 2007 I also have a Mersenne Twister implementation available at:
- Bill Baxter (3/23) Nov 17 2007 Note: Jason's is GPLv3.
- Jason House (5/6) Nov 17 2007 ... Covering 5 lines of code + imports + unit tests...
- BCS (4/18) Nov 17 2007 If you want svn hosting for this you can put it in scrapple:
- Tyro[a.c.edwards] (2/26) Nov 18 2007 Much appreciated. My user name is tyro.
- BCS (2/2) Nov 18 2007 Reply to tyro[a.c.edwards],
- Derek Parnell (7/7) Nov 17 2007 LOL ... I did a port to D about a year or so ago, to help teach myself t...
- Matti Niemenmaa (7/10) Nov 18 2007 You ported MT19937, which is a bit different from the SFMT that Tyro por...
- Bill Baxter (14/21) Nov 18 2007 It looks nice.
- Tyro[a.c.edwards] (5/40) Nov 18 2007 Thanks --bb, in posting this, I'm was hoping for anyting advice I could
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
Nov 17 2007
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, AndrewI also have a Mersenne Twister implementation available at: http://housebot.svn.sourceforge.net/viewvc/housebot/trunk/housebot/random.d?view=log
Nov 17 2007
Jason House wrote:Tyro[a.c.edwards] wrote:Note: Jason's is GPLv3. --bbAfter 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, AndrewI also have a Mersenne Twister implementation available at: http://housebot.svn.sourceforge.net/viewvc/housebot/trunk/housebot/random.d?view=log
Nov 17 2007
Bill Baxter wrote:Note: Jason's is GPLv3.... Covering 5 lines of code + imports + unit tests... The bulk of the code has a looser license. If someone wants to use it as part of D, I can (and will) get permission to remove the GPLv3 license.
Nov 17 2007
Reply to tyro[a.c.edwards],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, AndrewIf you want svn hosting for this you can put it in scrapple: http://www.dsource.org/projects/scrapple/ If you don't have access, send me a username and I'll add you.
Nov 17 2007
BCS さんは書きました:Reply to tyro[a.c.edwards],Much appreciated. My user name is tyro.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, AndrewIf you want svn hosting for this you can put it in scrapple: http://www.dsource.org/projects/scrapple/ If you don't have access, send me a username and I'll add you.
Nov 18 2007
LOL ... I did a port to D about a year or so ago, to help teach myself the language. I'll try to dig it out for comparision. I remember adding some extra functions and also allowing for additional entropy to be included. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell
Nov 17 2007
Derek Parnell wrote:LOL ... I did a port to D about a year or so ago, to help teach myself the language. I'll try to dig it out for comparision. I remember adding some extra functions and also allowing for additional entropy to be included.You ported MT19937, which is a bit different from the SFMT that Tyro ported. I've got the code (see attachment), but the original main function is missing. There's also Wang Zhen's port, which provides a Random class: http://lists.puremagic.com/pipermail/digitalmars-d-announce/2006-April/000816.html -- E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi
Nov 18 2007
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, AndrewIt 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
Nov 18 2007
Bill Baxter さんは書きました:Tyro[a.c.edwards] wrote: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. AndrewAfter 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, AndrewIt 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
Nov 18 2007