Pseudorandom Number Generator

PySkein contains a PRNG based on Skein-512. It is implemented as a subclass of the standard library’s random.Random class and can therefore be used in the same way. The seed may be given as a bytes object:

>>> import skein
>>> r = skein.Random(b'my seed')
>>> r.random()
0.5120516960943258

or any other hashable object - in which case random.Random is used internally to derive a bytes seed:

>>> skein.Random(12345).random()
0.4814263222592855

The same happens when no seed is given, so that the initial state is then derived from a suitable system source of randomness (like /dev/urandom or the time):

>>> r = skein.Random()
>>> r.random()
0.9696830103216001

All other methods of skein.Random are based on random(). For their documentation please refer to random.Random.

Previous topic

Threefish encryption

Next topic

Demo Scripts

This Page

Quick search