diff options
Diffstat (limited to 'bin/rndi.awk')
-rw-r--r-- | bin/rndi.awk | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/rndi.awk b/bin/rndi.awk index 07c69bc7..7d5a5b96 100644 --- a/bin/rndi.awk +++ b/bin/rndi.awk @@ -16,10 +16,13 @@ BEGIN { if (lower >= upper) fail("Bounds must be numeric, first lower than second") - # Seed the random number generator + # Get a random seed if rnds(1df) available rnds = "rnds 2>/dev/null" rnds | getline seed close(rnds) + + # Truncate the seed to 8 characters because mawk might choke on it + seed = substr(seed,1,8) if (length(seed)) srand(seed + 0) else |