Toot

Written by Luc on 2025-01-30 at 19:48

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

Mentions

Tags

Proxy Information
Original URL
gemini://mastogem.picasoft.net/toot/113919035010043219
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
215.429797 milliseconds
Gemini-to-HTML Time
0.480088 milliseconds

This content has been proxied by September (3851b).