diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-06 13:29:27 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-06 13:29:27 +1200 |
commit | 25f4dc16322e2ec73fa0a270ded85688979b22c9 (patch) | |
tree | 12892371a18ee9b42505d396c860d66f651ac435 /games | |
parent | Another world for kvlt(6) (diff) | |
download | dotfiles-25f4dc16322e2ec73fa0a270ded85688979b22c9.tar.gz dotfiles-25f4dc16322e2ec73fa0a270ded85688979b22c9.zip |
Truncate very long seeds
Diffstat (limited to 'games')
-rwxr-xr-x | games/rndn | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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" |