Hash of integers for use in Random module

Will McGugan news at NOwillmcguganSPAM.com
Sun Mar 6 10:34:33 EST 2005


Will McGugan wrote:
> Hi,
> 
> If I retrieve the hash of an integer, will it always return the same 
> value across platforms?
> 
> This reason I ask is that I want to produce a sequence of pseudo random 
> numbers using the random module, that I can re-create later on. So I'll 
> need to store the seed value, but Random.seed takes a hashable object 
> rather than an integer directly.
> 
> Which brings another question to mind. Are hashes of builtin objects in 
> general consistent across platforms, or are they an implementation 
> detail that could change?

*sigh* Didnt read the docs closely enough. It does say that ints and 
longs are used directly..

Will



More information about the Python-list mailing list