aboutsummaryrefslogtreecommitdiff
path: root/bin/rndi
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-01 10:23:34 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-01 10:23:34 +1200
commita88bc7eefae9c0d187b2d41f3ff5e593b05239ad (patch)
tree8546b96e6fb570116e0cecd5362f553f8389b408 /bin/rndi
parentChange sue(8) to POSIX sh (diff)
downloaddotfiles-a88bc7eefae9c0d187b2d41f3ff5e593b05239ad.tar.gz
dotfiles-a88bc7eefae9c0d187b2d41f3ff5e593b05239ad.zip
Add rndi(1)
Diffstat (limited to 'bin/rndi')
-rwxr-xr-xbin/rndi9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/rndi b/bin/rndi
new file mode 100755
index 00000000..3b0ea005
--- /dev/null
+++ b/bin/rndi
@@ -0,0 +1,9 @@
+#!/usr/bin/awk -f
+# Get a low-quality random number between two integers. Note that depending on
+# implementation, this might return the same number if run in the same second.
+# It's only for trivial purposes.
+BEGIN {
+ srand()
+ print int(ARGV[1]+rand()*(ARGV[2]-ARGV[1]+1))
+ exit
+}