From d0e5025b103f6e02500f2d9f48d4c3d0c5b2b084 Mon Sep 17 00:00:00 2001 From: makefu Date: Sun, 31 Jul 2011 02:16:15 +0200 Subject: randline: reimplemented --- util/bin/randline | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'util/bin') diff --git a/util/bin/randline b/util/bin/randline index cd9476e7..051734c5 100755 --- a/util/bin/randline +++ b/util/bin/randline @@ -1,12 +1,3 @@ #! /bin/sh -# -# choose a line randomly. -# -set -euf -lines="`cat`" -count=`echo "$lines" | wc -l` -random=`od -An -t u8 -N 8 /dev/urandom` -choice=`echo "$random % $count + 1" | bc` - -echo "$lines" | sed -n "${choice}p" +cat | shuf | head -n 1 -- cgit v1.2.3