aboutsummaryrefslogtreecommitdiff
path: root/shell/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/random.c')
-rw-r--r--shell/random.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/shell/random.c b/shell/random.c
index cca9d120d..7f5821cbc 100644
--- a/shell/random.c
+++ b/shell/random.c
@@ -20,6 +20,13 @@ next_random(random_t *rnd)
20 20
21 uint32_t t; 21 uint32_t t;
22 22
23 if (UNINITED_RANDOM_T(rnd)) {
24 /* Can use monotonic_ns() for better randomness but for now
25 * it is not used anywhere else in busybox... so avoid bloat
26 */
27 INIT_RANDOM_T(rnd, getpid(), monotonic_us());
28 }
29
23 /* LCG has period of 2^32 and alternating lowest bit */ 30 /* LCG has period of 2^32 and alternating lowest bit */
24 rnd->LCG = 1664525 * rnd->LCG + 1013904223; 31 rnd->LCG = 1664525 * rnd->LCG + 1013904223;
25 /* Galois LFSR has period of 2^32-1 = 3 * 5 * 17 * 257 * 65537 */ 32 /* Galois LFSR has period of 2^32-1 = 3 * 5 * 17 * 257 * 65537 */