From 524888d2fdfea9b83b0725f9c1ea9620990cdf0d Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Sun, 13 Mar 2016 01:52:03 +0000 Subject: [PATCH] use shuf rather than od because it is more readable Thanks to @marmarek for the suggestion! https://github.com/QubesOS/qubes-core-admin/pull/23/files#r55930643 --- qubes-rpc/qubes.GetRandomizedTime | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/qubes-rpc/qubes.GetRandomizedTime b/qubes-rpc/qubes.GetRandomizedTime index 54d78d1b..53341f21 100755 --- a/qubes-rpc/qubes.GetRandomizedTime +++ b/qubes-rpc/qubes.GetRandomizedTime @@ -25,13 +25,10 @@ set -e ## Get a random 0 or 1. ## Will use this to decide to use plus or minus. -## -## Thanks to -## http://linux.byexamples.com/archives/128/generating-random-numbers/ -ZERO_OR_ONE="$(( 0+($(od -An -N2 -i /dev/random) )%(0+2) ))" +ZERO_OR_ONE="$(shuf -i0-1 -n1 --random-source=/dev/random)" ## Create a random number between 0 and 180. -DELAY="$(( $(od -An -N2 -i /dev/random)%(180-0+1) ))" +DELAY="$(shuf -i0-180 -n1 --random-source=/dev/random)" ## Create a random number between 0 and 999999999. ##