From a88bc7eefae9c0d187b2d41f3ff5e593b05239ad Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 1 Aug 2016 10:23:34 +1200 Subject: Add rndi(1) --- bin/rndi | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 bin/rndi (limited to 'bin/rndi') 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 +} -- cgit v1.2.3