Skip to content

Instantly share code, notes, and snippets.

@tanzby
Created October 9, 2020 06:09
Show Gist options
  • Select an option

  • Save tanzby/beed526709560cb7b97ffcfb3108a786 to your computer and use it in GitHub Desktop.

Select an option

Save tanzby/beed526709560cb7b97ffcfb3108a786 to your computer and use it in GitHub Desktop.
Generate Uniform Random Value
#include <random>
template <typename T>
int UniformRand(const T min, const T max)
{
static thread_local std::mt19937 generator(std::random_device{}());
std::uniform_int_distribution<T> distribution(min, max);
return distribution(generator);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment