Hacker News new | past | comments | ask | show | jobs | submit login

It's pretty common in practice to want [0,1) (that is, 0 <= x < 1) from your random number generator. Never generating 0 would be a problem when the range is small and discrete - generating random letters for example.



If you're generating integers, or selecting from a discrete set with uniform probabilities, there's no reason to involve floating point at any point in the process.




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

Search: