3 ms·
The claim that the C standard suggests not using it is disingenuous: The footnote in question just says that there aren't implementation quality guarantees and
by fulafel 12y ago
The claim that the C standard suggests not using it is disingenuous: The footnote in question just says that there aren't implementation quality guarantees and specific requirements can be met with application specific RNGs. This applies to most of the standard library...
Also the anecdote about bad rand() in a 1983 BSD libc says little about current rand() implementations!
These look ok, for example:
https://github.com/lattera/glibc/blob/master/stdlib/random_r.c https://github.com/lattera/glibc/blob/master/stdlib/random_r...
https://www.opensource.apple.com/source/Libc/Libc-320/stdlib/FreeBSD/rand.c https://www.opensource.apple.com/source/Libc/Libc-320/stdlib...
Of course it's true that relying on libc implementation quality is always risky for maximally portable programs. Same can be said for stdio, malloc, etc etc.
- tedunangst 12y agorand() and random() are different functions.