aboutsummaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-07-06 13:29:27 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-07-06 13:29:27 +1200
commit25f4dc16322e2ec73fa0a270ded85688979b22c9 (patch)
tree12892371a18ee9b42505d396c860d66f651ac435 /games
parentAnother world for kvlt(6) (diff)
downloaddotfiles-25f4dc16322e2ec73fa0a270ded85688979b22c9.tar.gz
dotfiles-25f4dc16322e2ec73fa0a270ded85688979b22c9.zip
Truncate very long seeds
Diffstat (limited to 'games')
-rwxr-xr-xgames/rndn3
1 files changed, 3 insertions, 0 deletions
diff --git a/games/rndn b/games/rndn
index ebbee9f6..b4faed65 100755
--- a/games/rndn
+++ b/games/rndn
@@ -36,6 +36,9 @@ shift "$((OPTIND-1))"
# If no seed given, get one from Bash's $RANDOM
: "${seed:=$((RANDOM ** 2))}"
+# Truncate the seed
+seed=${seed:0:32}
+
# Check seed meets algorithm conditions
if [[ $seed == *[^0-9]* ]] || ((seed < 0)) ; then
printf >&2 '%s: error: seed must be non-negative integer\n' "$self"