random changes

Chris Reedy creedy at mitretek.org
Fri Aug 8 20:56:53 CEST 2003


Tim Peters wrote:
> [Chris Reedy]
> 
>>Here are some interesting numbers:
>>
>> [snip example showing changes in normalvariate]
> 
> 
> Odd!  I don't have Python 2.2.2 anymore.  Under Python 2.2.3, the results
> are identical (and match the results you got for 2.3).
> 
> [snip example showing no changes in normalvariate]
 >
> I have to go back to 2.1.3 to get your 2.2.2 results:
> 
> C:\Code>\python21\python temp.py
> (2, 1, 3, 'final', 0)
> 0.50177345778280169 0.28856727700571438
> 0.0021149783637115457 0.99131361156374964
> 
> As Raymond pointed out in another post, the WH seed method was changed in a
> bugfix release, because it had bad flaws.  The old method is still available
> in post-bugfix releases under the name .whseed(); use of it can't be
> recommended, though.
> 
> 

I checked CVS. The following change was added between 2.2.2 and 2.2.3:

Correct long standing bugs in the methods for random distributions.
The range of u=random() is [0,1), so log(u) and 1/x can fail.
Fix by setting u=1-random() or by reselecting for a usable value.

This impacted exactly the variates I noticed. I think this explains the 
issue.

   Chris



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----




More information about the Python-list mailing list