Why is rand()%6 biased? – stackoverflow.com

When reading how to use std::rand, I found this code on cppreference.com // roll a 6-sided die 20 times for (int n=0; n != 20; ++n) { int x = 7; while(x > 6) x = 1 + ...

from Hot Questions - Stack Exchange OnStackOverflow
via Blogspot

Share this

Artikel Terkait

0 Comment to "Why is rand()%6 biased? – stackoverflow.com"