bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Use high bits of the raw random number?


From: Peng Yu
Subject: Use high bits of the raw random number?
Date: Thu, 9 May 2019 09:29:05 -0500

Hi,

Bash uses the low 16 bits for $RANDOM.

https://git.savannah.gnu.org/cgit/bash.git/tree/variables.c#n1321
https://git.savannah.gnu.org/cgit/bash.git/tree/variables.c#n1356

It seems that the high bits should be more random. If so, maybe the
high 16 bits should be kept if $RANDOM must stay in 16bits?

https://stackoverflow.com/questions/13104478/uniformity-of-random-numbers-taken-modulo-n

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]