SHA-based subclass for Random module

David Lees abcdebl2nonspammy at verizon.net
Sun Mar 14 00:00:02 EST 2004


Paul Rubin wrote:
> http://www.nightsong.com/phr/python/sharandom.py
> 
> This is intended to be less predicable/have fewer correlations than
> the default Mersenne Twister or Wichmann-Hill generators.  Comments
> are appreciated.
Paul,

I get the error:
Traceback (most recent call last):
   File 
"C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", 
line 310, in RunScript
     exec codeObject in __main__.__dict__
   File "C:\ShaRandom.py", line 50, in ?
     print test()
   File "C:\ShaRandom.py", line 47, in test
     s += v.random()
   File "C:\ShaRandom.py", line 14, in random
     return float(a)/newrand.m56
NameError: global name 'newrand' is not defined

Is this a problem with my Python installation or something defining 
newrand that you forgot to include?

David Lees




More information about the Python-list mailing list