[Numpy-discussion] random and RandomArray

Bruce Southey southey at uiuc.edu
Thu Feb 17 07:28:19 EST 2005

The Mersenne Twister is available in Python as: 
This file contains the outdated information: 
"The code in this module was based on a download from: 
The redirected link is titled: Mersenne Twister with improved initialization 
A brief look at randlib() suggests that it is written so that different uniform 
generators could be used. Could randf() be rewritten to have the default 
(current status) function and a second that just to link to the random module 
library to use the Mersenne Twister?  
Okay, I do know it is not that easy (the seed code would also need to change so 
account for which generator is being used) but may be sufficient. 
---- Original message ---- 
>Date: Wed, 16 Feb 2005 20:05:09 -0800 
>From: Robert Kern <rkern at ucsd.edu>   
>Subject: Re: [Numpy-discussion] random and RandomArray   
>To: numpy-discussion at lists.sourceforge.net 
>Bruce Southey wrote: 
>> Hi,  
>> I was browsing through some of the code and realized that certain random 
>> generators occur in both the Python random module and RandomArray.   
>> The random module uses C code to get a scalar uniform random number that is  
>> modified in Python by other generators to get random numbers from other  
>> distributions. In RandomArray everything is done in the C code - obviously 
>> is way faster especially for arrays.  
>> In the long term, would it make sense to get use the same random number  
>> generators in both random and RandomArray?  
>I think that it is certainly feasible and desirable that when/if a  
>multiarray object enters the standard library that the standard random  
>module be extended to produce arrays as well. 
>I don't think it's terribly worthwhile to hack the random module to  
>expose its PRNG so that we use it's implementation without duplicating  
>code. I think the result will be quite fragile, and won't be useful  
>until Python 2.5. 
>I do think it would be extremely worthwhile to implement the Mersenne  
>Twister for numarray/scipy. I promised some time ago to look into this,  
>but I have not gotten around to it, unfortunately. 
>Robert Kern 
>rkern at ucsd.edu 
>"In the fields of hell where the grass grows high 
>  Are the graves of dreams allowed to die." 
>   -- Richard Harter 
>SF email is sponsored by - The IT Product Guide 
>Read honest & candid reviews on hundreds of IT Products from real users. 
>Discover which products truly live up to the hype. Start reading now. 
>Numpy-discussion mailing list 
>Numpy-discussion at lists.sourceforge.net 

More information about the NumPy-Discussion mailing list