News for hackers. Stuff that matters.
Re:Modern C++ Won't Save Us by whyever on Tuesday April 23, 2019 @11:14AM (#19729416)
> (rand() % (b - a)) + a;

This is no longer uniform, because it introduces a bias towards small numbers.

Re:Modern C++ Won't Save Us by sorenjan on Tuesday April 23, 2019 @12:49PM (#19730396)
Yes, it's less than ideal. But like I said, often good enough. Sometimes you just want a simple way to get something approximately random, the actual distribution might be unimportant.