Hi,

I included the code of Mersenne Twister 
(http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html, 
  the header and RNG code from the mt19937ar.sep.tgz package) in the src 
directory without any changes. I wrote an interface to this RNG:

void plseed(unsigned int s);
unsigned long plrandi(void);
PLFLT plrandd(void);

With plseed you can initialize the RNG with an integer (there is no need 
to), plrandi returns an integer and plrandd returns a double/float in 
the [0,1] interval. Any comments to the names of the functions and the 
interface itself are welcome. The interface is quite general (e.g. no 
initialization with an array), so it's easy to replace Mersenne Twister 
if needed.

I also implemented the c++ bindings and made corresponding changes to 
example 21. I tested these changes on Windows XP with Visual C++ 2008. I 
will test it on Ubuntu soon - but as usual there might be problems.

Best Regards,
Werner

Werner Smekal wrote:
> Hi Alan,
> 
>> Since it appears you can implement this internally (i.e., no additional
>> external libraries are involved) I encourage you to go ahead two weeks from
>> now. From Wikipedia, the Mersenne Twister RNG is a better choice than the
>> historical but rather flawed middle-square method that I mentioned. Also,
>> your idea of putting a RNG within the PLplot library rather than example 21
>> is a good one.  I have required RNG's for past plotting needs, I am sure
>> many of our users have similar needs. Furthermore, the interactive example
>> 17 could use a library RNG as well as example 21. Finally, it means we only
>> have to implement a binding interface to the C version of the RNG for each
>> of our bindings. That is actually much simpler than implementing the same
>> RNG in many different languages for example 21 (and 17).
> 
> Ok, so I'll go ahead implementing the code.
> 
> Regards,
> Werner
> 


-- 
Dr. Werner Smekal
Institut fuer Allgemeine Physik
Technische Universitaet Wien
Wiedner Hauptstr 8-10
A-1040 Wien
Austria

email: [EMAIL PROTECTED]
web:   http://www.iap.tuwien.ac.at/~smekal
phone: +43-(0)1-58801-13463 (office)
        +43-(0)1-58801-13469 (laboratory)
fax:   +43-(0)1-58801-13499

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to