what is the best way to do this? my compiler shows RAND_MAX = 32,767. so I'm curious how I can get a uniform random generation of values between 0 and 100,000?
I'll just put juanchopanza's comment into answer.
Use the <random>
header if your compiler provides it (C++11).
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(0, 10000);
std::cout << dis(gen) << std::endl;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With