Template Function swri_math_util::GetUniformRandomSample

Function Documentation

template<class RNG>
void swri_math_util::GetUniformRandomSample(RNG &rng, int32_t min, int32_t max, int32_t count, std::vector<int32_t> &sample)

Gets a uniform random sample of integers without repeats for a given range.

The number of samples should be much smaller than the number of possible values in the range for optimal performance.

This function depends on a random number generator (RNG) being provided, which generally aren’t thread safe. It is recommended that a multi-threaded application create a seperate RNGs for each thread.

param[in] rng The random number generator. param[in] min The minimum of the range (inclusive). param[in] max The maximum of the range (inclusive). param[in] count The sample size. param[out] sample The sample.