← All projects
Project record1 mention
Originally shared on Hacker News

random

A deterministic, cross-platform, cryptographically-secure procedural random number generator library that guarantees identical values on every OS. It supports many distribution types (uniform, normal via Box-Muller, exponential, Poisson, log-normal, beta) with configurable inputs, can plot the distribution in the terminal, and can source the best-in-class OS entropy source for true random. It avoids IEEE754 floating point by using fixed-point mantissa/exponent binary arithmetic, and is implemented in both LuaJIT and Zig with C FFI under an MIT license.

Last shared For Fuzz-testing and software developers who need reproducible random values across platforms.
01 / The problem

What it addresses

Fuzz testing failures could not be reproduced locally in CI because glibc, musl and macOS return different floating point values for certain trig/transcendental functions across operating systems.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. random

    A deterministic, cross-platform, cryptographically-secure procedural random number generator library that guarantees identical values on every OS. It supports many distribution types (uniform, normal via Box-Muller, exponential, Poisson, log-normal, beta) with configurable inputs, can plot the distribution in the terminal, and can source the best-in-class OS entropy source for true random. It avoids IEEE754 floating point by using fixed-point mantissa/exponent binary arithmetic, and is implemented in both LuaJIT and Zig with C FFI under an MIT license.

    Problem: Fuzz testing failures could not be reproduced locally in CI because glibc, musl and macOS return different floating point values for certain trig/transcendental functions across operating systems.

    Audience: Fuzz-testing and software developers who need reproducible random values across platforms.

    Posted by @pmarreck · Original source ↗

    Source text · @pmarreck · · Source ↗

    Apparently this is the only deterministic, cross-platform, cryptographically-secure procedural RNG that has many types of distributions (uniform (default), normal (Box-Muller), exponential, Poisson, log-normal, beta... all with configurable inputs AND which will plot the distribution for you in the terminal!) AND is guaranteed to give you the same values... Everywhere. (Because how the fuck has this not existed yet??) Implemented in both LuaJIT and Zig with C FFI.