Skip to main content

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 1s on my laptop.

NumPy support:

import numpy
from shishua import SHISHUA
buffer = numpy.random.Generator(SHISHUA()).bytes(1024)
print(buffer.hex())

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 a bytes filled with random bytes.

Metadata

Release files for shishua 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shishua 0.2.0
File Size Uploaded
shishua-0.2.0.tar.gz 53.7 kB Details

Release files / shishua-0.2.0.tar.gz

Download URL shishua-0.2.0.tar.gz
Size 53.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6cec6d4d2f12af7dfeaebc6903d56660938a3292b5dbb87ad5ef3a5b6fb98695
BLAKE2b-256 checksum
How to use checksums
83ea4fb68a9ab938f46a4aa3c6d8e1db6aeb24b64dcc5e6439a1aaebf35f8428
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.0

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page