Skip to content

function random_normal(random_state &, T, T) random

template <size_t N, typename T>
KFR_INTRINSIC vec<T, N> random_normal(random_state& state, T mu, T sigma)

Generates N normally distributed (Gaussian) random values using Box-Muller transform.

Uses 2x uniform samples to generate normal values, rounded to the nearest power-of-two vector length.

Template parameters
N Number of normal values to generate.
T Floating-point type.
Parameters
state Reference to the random number generator state.
mu Mean of the distribution.
sigma Standard deviation of the distribution.
Returns
Vector of N values from N(mu, sigma^2).

Defined at base/random.hpp:127