Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
clarry
on Dec 9, 2014
|
parent
|
context
|
favorite
| on:
Random in the wild
Doesn't matter what your RAND_MAX is if you're taking the result modulo anything that's not a power of two.
conistonwater
on Dec 9, 2014
[–]
No, it does matter. If RAND_MAX is really large, the relative error in "incorrect" probabilities is really small. Unless you have a critical need for it to be precisely correct, the error is basically negligible.
clarry
on Dec 10, 2014
|
parent
|
next
[–]
I have no idea what I was thinking, but I stand corrected. Thanks.
christianmann
on Dec 10, 2014
|
parent
|
prev
[–]
And if you have a need for it to be precisely correct, I have bad news for you about the word "random".
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: