15#ifndef SBL_DSP_PRIMITIVES_RNG_HPP_
16#define SBL_DSP_PRIMITIVES_RNG_HPP_
32 state_ ^= state_ << 13;
33 state_ ^= state_ >> 17;
34 state_ ^= state_ << 5;
41 return (
static_cast<float>(
next() >> 1) / 1073741824.0f) - 1.0f;
46 return static_cast<float>(
next() >> 1) / 2147483647.0f;
50 void seed(uint32_t s) { state_ = s ? s : 1; }
float unipolar()
Random float in [0.0, 1.0].
float bipolar()
Random float in [-1.0, 1.0].
uint32_t next()
Advance state and return raw 32-bit value.
void seed(uint32_t s)
Set state directly (for test reproducibility).
Stateful, single-concern building blocks.