PureRNGs.jl

PureRNGs provides counter-based random numbers with explicit state. Generate arrays on a CPU or GPU, or draw inside your own kernels.

using PureRNGs, Random

rng = Philox4x32(123456)
values, next_rng = rand_next(rng, Float32, 4)
@assert values == rand_at(rng, Float32, 1:4)
values
4-element Vector{Float32}:
 0.053103805
 0.2822104
 0.3456427
 0.5453631

The draw leaves rng unchanged. Use next_rng to continue the stream.

Start here

Read Getting started for the basic workflow. Then choose a task:

Understand the contract

Generators and streams explains keys, positions, and splitting. Reproducibility separates stream guarantees from floating-point differences. Devices lists backend support and placement rules.

Random interoperability, Distributions, and Differentiation and compilation cover optional integrations. The API reference lists exported functions. See Acknowledgements for prior art and full references for the algorithms and validation tools.

PureRNGs is not a cryptographic random-number generator.