Skip to content

PRNG functions and expressions

gen_random_normal function

template <typename T, index_t Dims = 1>
expression_random_normal<T, Dims>
gen_random_normal(const random_state &state, T sigma = 1,
                  T mu = 0)

Returns expression that returns pseudorandom values from normal (gaussian) distribution. Copies the given generator

Source code
template <typename T, index_t Dims = 1>
KFR_FUNCTION expression_random_normal<T, Dims> gen_random_normal(const random_state& state, T sigma = 1,
                                                                 T mu = 0)
{
    return { {}, state, sigma, mu };
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/random.hpp#L216

template <typename T, index_t Dims = 1>
expression_random_normal<T, Dims, true> gen_random_normal(
    std::reference_wrapper<random_state> state, T sigma = 1,
    T mu = 0)

Returns expression that returns pseudorandom values from normal (gaussian) distribution. References the given generator. Use std::ref(gen) to force this overload

Source code
template <typename T, index_t Dims = 1>
KFR_FUNCTION expression_random_normal<T, Dims, true> gen_random_normal(
    std::reference_wrapper<random_state> state, T sigma = 1, T mu = 0)
{
    return { {}, state, sigma, mu };
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/random.hpp#L225

template <typename T, index_t Dims = 1>
expression_random_normal<T, Dims>
gen_random_normal(T sigma = 1, T mu = 0)

Returns expression that returns pseudorandom values from normal (gaussian) distribution

Source code
template <typename T, index_t Dims = 1>
KFR_FUNCTION expression_random_normal<T, Dims> gen_random_normal(T sigma = 1, T mu = 0)
{
    return { {}, random_init(), sigma, mu };
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/random.hpp#L234

gen_random_range function

template <typename T, index_t Dims = 1>
expression_random_range<T, Dims>
gen_random_range(const random_state &state, T min, T max)

Returns expression that returns pseudorandom values of the given range. Copies the given generator

Source code
template <typename T, index_t Dims = 1>
KFR_FUNCTION expression_random_range<T, Dims> gen_random_range(const random_state& state, T min, T max)
{
    return { {}, state, min, max };
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/random.hpp#L190

template <typename T, index_t Dims = 1>
expression_random_range<T, Dims, true>
gen_random_range(std::reference_wrapper<random_state> state,
                 T min, T max)

Returns expression that returns pseudorandom values of the given range. References the given generator. Use std::ref(gen) to force this overload

Source code
template <typename T, index_t Dims = 1>
KFR_FUNCTION expression_random_range<T, Dims, true> gen_random_range(
    std::reference_wrapper<random_state> state, T min, T max)
{
    return { {}, state, min, max };
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/random.hpp#L198

template <typename T, index_t Dims = 1>
expression_random_range<T, Dims> gen_random_range(T min,
                                                  T max)

Returns expression that returns pseudorandom values of the given range

Source code
template <typename T, index_t Dims = 1>
KFR_FUNCTION expression_random_range<T, Dims> gen_random_range(T min, T max)
{
    return { {}, random_init(), min, max };
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/random.hpp#L207

gen_random_uniform function

template <typename T, index_t Dims = 1>
expression_random_uniform<T, Dims>
gen_random_uniform(const random_state &state)

Returns expression that returns pseudorandom values. Copies the given generator

Source code
template <typename T, index_t Dims = 1>
KFR_FUNCTION expression_random_uniform<T, Dims> gen_random_uniform(const random_state& state)
{
    return { {}, state };
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/random.hpp#L165

template <typename T, index_t Dims = 1>
expression_random_range<T, Dims, true> gen_random_uniform(
    std::reference_wrapper<random_state> state)

Returns expression that returns pseudorandom values. References the given generator. Use std::ref(gen) to force this overload

Source code
template <typename T, index_t Dims = 1>
KFR_FUNCTION expression_random_range<T, Dims, true> gen_random_uniform(
    std::reference_wrapper<random_state> state)
{
    return { {}, state };
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/random.hpp#L173

template <typename T, index_t Dims = 1>
expression_random_range<T, Dims> gen_random_uniform()

Returns expression that returns pseudorandom values

Source code
template <typename T, index_t Dims = 1>
KFR_FUNCTION expression_random_range<T, Dims> gen_random_uniform()
{
    return expression_random_uniform<T, Dims>{ random_init() };
}

https://github.com/kfrlib/kfr/blob//include/kfr/base/random.hpp#L182


Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/