ConstantRNGs.jl

A constant RNG, for cases when you need high efficiency and don't care about randomness
Author cscherrer
Popularity
3 Stars
Updated Last
1 Year Ago
Started In
July 2023

ConstantRNGs

Stable Dev Build Status Coverage

Someimes we have code that generates random values, but we don't really care about the randomness. Maybe we just need to know the shape of the result, or we're doing smoke testing. In these cases, the result of random sampling would be fine, but we might like to have something simpler without unnecessary overhead.

For example,

julia> using Random, ConstantRNGs

julia> randn(ConstantRNG())
0.0

julia> rand(ConstantRNG())
0.5

julia> randexp(ConstantRNG())
1.0

As always, there's a relevant XKCD: