scikitplot.random#

Random Number Generation (Numpy-Like Generator) [1] [2] [3].

Use default_rng() to create a Generator and call its methods.

References

[1]

Marsaglia, G. (1999). “Random Number Generators.” Journal of Modern Applied Statistical Methods, 2(1), 2-13.

[2]

Jones, D. “Good Practice in (Pseudo) Random Number Generation for Bioinformatics Applications.” https://www0.cs.ucl.ac.uk/staff/d.jones/GoodPracticeRNG.pdf

[3]

NumPy Development Team. “Random Generator.” https://numpy.org/doc/stable/reference/random/generator.html

Examples

>>> from scikitplot.random import default_rng, kiss_context
>>> rng = default_rng(42)
>>> data = rng.random(1000)

Context manager

>>> with default_rng(42) as rng:
...     data = rng.random(1000)
>>>
>>> with kiss_context(42) as rng:
...     data = rng.random(1000)

User guide. See the Random section for further details.

Random Number Generation (Numpy-Like Generator).#

User guide. See the Random section for further details.

Kiss32Random

32-bit KISS RNG with complete serialization support.

Kiss64Random

Low-level 64-bit KISS RNG with context manager support.

KissRandom

Factory function for auto-detecting 32-bit vs 64-bit RNG.

KissSeedSequence

Seed sequence compatible with numpy.random.SeedSequence.

KissBitGenerator

NumPy-compatible BitGenerator using KISS algorithm with complete serialization.

KissGenerator

High-level random number generator using KISS algorithm.

KissRandomState

NumPy RandomState-compatible interface with complete serialization.

default_rng

Create default KISS random number generator.

kiss_context

Context manager for temporary RNG.

KissGenerator Distribution Methods#

User guide. See the Random section for further details.

choice

Random sample from array.

integers

Random integers in [low, high) or [low, high].

normal

Normal distribution (Box-Muller transform).

permutation

Randomly permute sequence or return permuted range.

random

Random floats in [0, 1).

shuffle

Shuffle array in-place (Fisher-Yates algorithm).

uniform

Uniform distribution in [low, high).