<br><br><div><span class="gmail_quote">On 6/4/06, <b class="gmail_sendername">Robert Kern</b> <<a href="mailto:robert.kern@gmail.com">robert.kern@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Charles R Harris wrote:<br>> For generating large<br>> arrays of random numbers on 64 bit architectures it looks like MWC8222<br>> is a winner. So, the question is, is there a good way to make the rng<br>> selectable?
<br><br>Sure! All of the distributions ultimately depend on the uniform generators<br>(rk_random, rk_double, etc.). It would be possible to alter the rk_state struct<br>to store data for multiple generators (probably through a union) and store
<br>function pointers to the uniform generators. The public API rk_random,<br>rk_double, etc. would be modified to call the function pointers to the private<br>API functions depending on the actual generator chosen.<br><br>
At the Pyrex level, some modifications would need to be made to the RandomState<br>constructor (or we would need to make alternate constructors) and the seeding<br>methods.</blockquote><div><br> </div><div>Heh, I borrowed some seeding methods from numpy, but put them in their own file with interfaces
<br><br>void fillFromPool(uint32_t *state, size_t size);<br>void fillFromSeed(uint32_t *state, size_t size, uint32_t seed);<br>void fillFromVect(uint32_t *state, size_t size, const std::vector<uint32_t> & seed);
<br><br>So that I could use them more generally. I left out the method using the system time because, well, everything I am interested in runs on linux or windows. Boost has a good include file, boost/cstdint.hpp, that deals with all the issues of defining integer types on different platforms. I didn't use it, though, just the
stdint.h file ;)<br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Nothing too bad. I don't think it would be worthwhile to change the
<br>numpy.random.* functions that alias the methods on the default RandomState<br>object. Code that needs customizable PRNGs should be taking a RandomState object<br>instead of relying on the function-alike aliases.</blockquote>
<div><br>I'll take a look, though like you I am pretty busy these days. <br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">--<br>
Robert Kern</blockquote><div><br>Chuck <br></div><br></div><br>