[Bug 260709] arc4random() non-randomness

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 17 Jan 2022 18:06:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260709

--- Comment #2 from wbe@psr.com ---
I generally agree that running 'jot -r 1 0 3600' several times in a row at a
console probably does produce a good result.  However, in the particular case I
described, it observably doesn't.

'jot -r 1 0 3600' (after shell variable substitution) is the controlling code
for the sleep time.  The sleep times are very much NOT random.  Here are the
results for the 17 days of January so far:

Jan  4 03:02:22
Jan  7 03:02:22
Jan  8 03:02:22
Jan 10 03:02:22
Jan 11 03:02:22
Jan 14 03:02:22
Jan 16 03:02:22
Jan  1 03:02:23
Jan  3 03:02:23   ____ 9
Jan 17 03:02:55
Jan 13 03:03:13   ____ 11
Jan 15 03:15:04
Jan  5 03:19:25
Jan  6 03:26:10
Jan 12 03:52:37
Jan  9 03:57:22
Jan  2 04:02:11   ____ 17

That's 9 out of 17 times getting a result of 0 or 1 out of the range of 0-3600,
and 11 out of 17 in the range 0-51.  52-3600 only happened 6 out of 17 times.

-- 
You are receiving this mail because:
You are the assignee for the bug.