SyntaxFix
Write A Post
Hire A Developer
Questions
It doesn't. It makes 0 <= r < 1, but your original is 0 <= r <= 1.
0 <= r < 1
0 <= r <= 1
Note that this can lead to undefined behavior if RAND_MAX + 1 overflows.
RAND_MAX + 1