aboutsummaryrefslogtreecommitdiff
path: root/bin/rndi
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-03 18:16:10 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-03 18:16:10 +1200
commit1d7bc34e01e416d84839e01529484b29311aa96d (patch)
tree16f27417d9d45f1b6e8ee79bd79c3601cc94b048 /bin/rndi
parentAdd mentions to rndn(6) manual page (diff)
downloaddotfiles-1d7bc34e01e416d84839e01529484b29311aa96d.tar.gz
dotfiles-1d7bc34e01e416d84839e01529484b29311aa96d.zip
Actually check for seed presence in rndi(1)
Diffstat (limited to 'bin/rndi')
-rwxr-xr-xbin/rndi7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/rndi b/bin/rndi
index f6cd33da..3dc8689c 100755
--- a/bin/rndi
+++ b/bin/rndi
@@ -3,7 +3,12 @@
# implementation, if you don't provide a third argument (a seed), you might get
# very predictable random numbers based on the current epoch second.
BEGIN {
- srand(ARGV[3])
+ if (ARGV[3]) {
+ srand(ARGV[3])
+ }
+ else {
+ srand()
+ }
print int(ARGV[1]+rand()*(ARGV[2]-ARGV[1]+1))
exit
}