Re: [SLUG] Free Gmail Raffle

From: Levi Bard (levi@bard.sytes.net)
Date: Fri Jun 11 2004 - 11:08:04 EDT


Put me in for one.

BTW, here's my contribution for a random chooser.
Looks fair, right? ;)

-- Begin --
#!/bin/sh
#Usage: random.sh name1 name2 name3 ...

random_between() {
        RANDNUM=`date -u "+%N"`
        RANGE=`echo "$2 - $1" | bc`
        echo `echo "${RANDNUM} % ${RANGE} + $1" | bc`
        return
}

value_of() {
        IND=$1
        CTR=1
        shift

        for i in "$@"
        do
                if test ${CTR} -eq ${IND}; then
                        echo "$i"
                        return
                fi
                CTR=`expr ${CTR} + 1`
        done
        return
}

echo "Winner one is Levi!"
WININD=`random_between 1 $#`
echo "Winner two is `value_of ${WININD} $@`!"

-- End --
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:25:38 EDT