SHISHUA: The fastest PRNG. A seedrandom-compatible random number generator.
Project description
SHISHUA for Python: The fastest PRNG
The official page for SHISHUA is here.
This PyPI package provides bindings for Python.
from shishua import SHISHUA
rng = SHISHUA(0)
buffer = rng.random_raw(1 << 30) # 1 GiB
# It takes 1.5s on my laptop.
API
SHISHUA(seed=None)
Returns a generator instance initialized with the given seed.
The seed
determines the sequence of numbers that this function returns:
print(SHISHUA('seed').random_raw(10).hex())
#> 1aa64a39f6949b969e97
print(SHISHUA('seed').random_raw(10).hex())
#> 1aa64a39f6949b969e97
print(SHISHUA('different seed, different values').random_raw(10).hex())
#> 216a0889a858eb57ae30
The seed can be either:
- A list of four 64-bit integers, to map exactly to the functionality provided by the underlying SHISHUA algorithm,
- A string, which is hashed into the four integers,
- A single integer, which sets the first of the four,
- If not provided (or undefined), a random seed is generated from the system's CSPRNG.
Associated methods
The object returned by calling SHISHUA()
also has the following methods,
which all tap into the stream generated by the seed:
.random_raw(size)
, which returns abytes
filled with random bytes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
shishua-0.1.0.tar.gz
(53.4 kB
view hashes)