System is:
pi@titania:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@titania:~ $ uname -a
Linux titania.####.net 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l GNU/Linux
I observe differing behavior between RANDOM and URANDOM when generating some random numbers. To wit:
pi@titania:~ $ echo $URANDOM | md5sum | head -c 20; echo;
68b329da9893e34099c7
pi@titania:~ $ echo $URANDOM | md5sum | head -c 20; echo;
68b329da9893e34099c7
pi@titania:~ $ echo $URANDOM | md5sum | head -c 20; echo;
68b329da9893e34099c7
pi@titania:~ $ echo $RANDOM | md5sum | head -c 20; echo;
a5355860c5367e0dc179
pi@titania:~ $ echo $RANDOM | md5sum | head -c 20; echo;
521938e64c42075b2b92
pi@titania:~ $ echo $RANDOM | md5sum | head -c 20; echo;
03505fd360ab7ae8378d
URANDOM generates the same output in a deterministic way and RANDOM does not, returning results that differ as expected each time.
I have kinda come to want to use URANDOM where possible so this piqued my interest.
Would anyone know why this difference?
John Springer
$URANDOM
? How do you define it? – terdon Jun 03 '22 at 16:08