srand(1)
a = rand()
srand(-1)
b = rand()
a == b?
Bash: yes (RANDOM=)
C: no (stdlib.srand)
C#: yes (System.Random)
JS: error (can't seed Math.random)
Lua: no (math.randomseed)
Perl: yes (srand)
PHP: no (srand)
Python: yes (random.seed, cpython&pypy)
Ruby: yes (srand)
is throwing away the sign bit at least documented? Only in C#! Python docs even say "all of its bits are used" but it's a lie.
I didn't expect much of Bash or C, but what blows my mind? PHP acting more sane than Python 🤯
=> More informations about this toot | View the thread | More toots from luc@chaos.social
text/gemini
This content has been proxied by September (3851b).