Random number with uniform distribution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Random number with uniform distribution

I'm trying to generate random numbers between zero and one with uniform distribution, is there any way?

26th Dec 2019, 10:07 AM
hossein B
hossein B - avatar
3 Answers
+ 6
Thanks for your reply Dennis, and Do you know what method is used to generate pseudo-random numbers in c++11?? Is it based on cpu clock?
26th Dec 2019, 10:47 AM
hossein B
hossein B - avatar
+ 4
That depends on the engine that you use that is listed on the same page. std::mt19937 is the one I usually use which uses the Mersenne Twister algorithm. https://en.wikipedia.org/wiki/Mersenne_Twister
26th Dec 2019, 10:56 AM
Dennis
Dennis - avatar