kwant.digest
– Random-access random numbers¶Random-access random numbers
This module provides routines that given some input compute a “random” output that depends on the input in a (cryptographically) intractable way.
This turns out to be very useful when one needs to map some irregular objects to random numbers in a deterministic and reproducible way.
Internally, the md5 hash algorithm is used. The randomness thus generated is
good enough to pass the “dieharder” battery of tests: see the function test
of
this module.
kwant.digest.
uniform
(input, salt='')[source]¶md5-hash input and salt and map the result to the [0,1) interval.
input must be some object that supports the buffer protocol (i.e. a string or a numpy/tinyarray array). salt must be a string or a bytes object.