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
This commit is contained in:
Patrick Schleizer 2016-03-13 01:52:03 +00:00
parent e33b958bdd
commit 524888d2fd
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -25,13 +25,10 @@ set -e
## Get a random 0 or 1. ## Get a random 0 or 1.
## Will use this to decide to use plus or minus. ## Will use this to decide to use plus or minus.
## ZERO_OR_ONE="$(shuf -i0-1 -n1 --random-source=/dev/random)"
## Thanks to
## http://linux.byexamples.com/archives/128/generating-random-numbers/
ZERO_OR_ONE="$(( 0+($(od -An -N2 -i /dev/random) )%(0+2) ))"
## Create a random number between 0 and 180. ## 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. ## Create a random number between 0 and 999999999.
## ##