Dylan William Hardison wrote:
>#!/usr/bin/perl
>use strict;
>use warnings;
>my @people = (
> "Dylan",
> "Levi",
>);
>my $victim = pick_person(\@people);
>print "And the winner is: $victim!\n";
>sub randint {
> open my $hat, "/dev/random" or die "Can't open /dev/random: $!";
> my $buf;
> read $hat, $buf, 1;
> close $hat;
> return ord($buf);
>}
>sub pick_person {
> my ($people) = @_;
> # Thanks to Levi for reminding me
> # of the properties of %.
> my $i = randint() % @people;
> return $people->[$i];
>}
>
>
--
--
dangit. i read the first Gmail email, and wrote my own bash script to
generate random name, thinking i was original and quick. ha!. i need to
learn to read all of the thread. these were much better then mine.
but oh well. here's my late, and completely unoriginal contribution.
yet another way...
!#/bin/bash
# pickgmailwinner.sh
people="
me
craig
you
craig
him
craig
her
thatguyoverthere
theladydownthestreet
someone
"people=($people)
num_people=${#people[*]}
echo -n "${people[$((RANDOM%num_people))]} "
-craig
-----------------------------------------------------------------------
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:27:48 EDT