Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

RAND_MAX is only guaranteed to be at least 32767. So if you use `rand() % 10000` you'll have real biased towards 0-2767, even `rand() % 1000` is already not uniform (biased towards 0-767). And that assumes rand() is good uniform from 0-RAND_MAX in the first place.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: