Post #4347458
2026-07-31 03:49 UTC
xorshift32 in #Bash, code golfed.
$ n(){ s=$[s^s<<13];s=$[s^s>>17];s=$[s^s<<5];echo $[s&2**32-1]; }
Example:
$ s=123456789
$ n
2937495369
$ n
559720438
$ n
3924597191
Bash already has $RANDOM and $SRANDOM, so this probably isn't all that useful. Shrug.
The seed $s must be non-zero.
#Linux
Replies (0)
No replies.