SHA-based subclass for random module

Raymond Hettinger python at rcn.com
Tue Mar 23 17:57:13 CET 2004


[Trevor Perrin]
>   - getrandstring() is a useful addition to the API, whereas 
> getrandbits() is trivally done by calling randint(0, 2**k).

Actually, randint() is implemented in terms of getrandbits() when
k>53.  This saves needless conversions in and out of floating point.


Raymond



More information about the Python-list mailing list