Files
libsst/libsst-random/README.md
James Russell 71230f918f Add module READMEs, .gitignore, and remove Bin/ from tracking
Add README.md for each library module documenting API, platform
backends, and usage. Add .gitignore for build artifacts. Remove
pre-built binaries from version control.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 00:27:55 -05:00

1019 B

libsst-random

Pseudorandom number generation and simplex noise in C.

PRNG algorithms

Type Enum State size
Mersenne Twister SST_PRNG_MERSENNE 624 x 32-bit
CMWC SST_PRNG_CMWC 4096 x 32-bit
SmallPRNG SST_PRNG_SMALLPRNG 4 x 32-bit

Generic API

SST_PRNG rng = SST_Random_CreatePRNGFromSeed(SST_PRNG_MERSENNE, 42);
float  f = SST_Random_GetPRNGFloat(rng, 0.0f, 1.0f);
int    i = SST_Random_GetPRNGInt(rng, 0, 100);
SST_Random_DestroyPRNG(rng);

Each algorithm also has direct-access functions (SST_Random_*SmallPRNG*, SST_Random_*CMWC*). Array-fill variants are provided for batch generation.

Simplex noise

1D through 4D simplex noise, returning values in [-1, 1]:

  • SST_Random_MapSimplexNoise{1,2,3,4}D()
  • Array variants: SST_Random_MapSimplexNoise{1,2,3,4}DFromArray()

C++ wrappers

  • ZRandomGenerator -- RAII wrapper with Gaussian distribution support
  • ZSimplexNoise -- RAII wrapper with noise1/noise2/noise3/noise4