From 3ec67bef94c4feacde558faf2cc68abf44890a32 Mon Sep 17 00:00:00 2001 From: HimbeerserverDE Date: Tue, 3 Jan 2023 17:04:29 +0100 Subject: fix slw randomness --- bin/slw | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/slw b/bin/slw index 5c93c26..03ed074 100755 --- a/bin/slw +++ b/bin/slw @@ -1,24 +1,30 @@ #! /bin/bash +rand() { + tr -dc 0-9 < /dev/urandom | head -c 5 | sed 's/^0*//' + echo +} + reset while [ true ]; do - CARS=$(( ${RANDOM} % 16 + 1 )) + CARS=$(( $(rand) % 16 + 1 )) + FLAGS="" - if [ $(( ${RANDOM} % 2 )) -eq 0 ]; then + if [ $(( $(rand) % 2 )) -gt 0 ]; then FLAGS="${FLAGS}-a " fi - if [ $(( ${RANDOM} % 2 )) -eq 0 ]; then - FLAGS="${FLAGS}-c" + if [ $(( $(rand) % 2 )) -gt 0 ]; then + FLAGS="${FLAGS}-c " fi - if [ $(( ${RANDOM} % 2 )) -eq 0 ]; then - FLAGS="${FLAGS}-l" + if [ $(( $(rand) % 2 )) -gt 0 ]; then + FLAGS="${FLAGS}-l " fi - if [ $(( ${RANDOM} % 2 )) -eq 0 ]; then - FLAGS="${FLAGS}-w" + if [ $(( $(rand) % 2 )) -gt 0 ]; then + FLAGS="${FLAGS}-w " fi sl -${CARS} ${FLAGS} | lolcat -- cgit v1.2.3