McMahon has asked for the wisdom of the Perl Monks concerning the following question:
Is there a convenient way to choose a single element of the array randomly?my @colors = ("yellow", "blue", "red")
my @colors = ("yellow", "blue", red") my $color = some_cool_perl_random_thingie(@colors); print "The surprise color is $color"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Choose random element of array?
by tinita (Parson) on May 28, 2004 at 16:27 UTC | |
|
Re: Choose random element of array?
by mojotoad (Monsignor) on May 28, 2004 at 16:32 UTC | |
by hsinclai (Deacon) on May 28, 2004 at 16:50 UTC | |
by mojotoad (Monsignor) on May 28, 2004 at 19:48 UTC | |
by hsinclai (Deacon) on May 29, 2004 at 03:23 UTC | |
by Somni (Friar) on May 28, 2004 at 23:51 UTC | |
by hsinclai (Deacon) on May 29, 2004 at 03:31 UTC | |
by Somni (Friar) on May 29, 2004 at 03:58 UTC | |
| |
|
Re: Choose random element of array?
by kesterkester (Hermit) on May 28, 2004 at 16:31 UTC |