in reply to Need help with number generator

(warning all code untested)

If you aren't worried about space, then that approach is fine enough, but perhaps:

@a = split /\s+/, join " ", ("1 " x 8, "2 " x 1, "3 " x 1); print $a[int(rand 10)];
Is more(?) clear?

However, I would not approach it this way. Instead, I would do something like:

my %wheel = {"One" => 8, "Two" => 1, "Three" => 1}; my $sum; my $item; foreach $item (keys %wheel) { $sum+=$wheel{$item}; } my $spin = int(rand($sum)); foreach $item (keys %wheel) { last if $sum < $wheel{$item}; $sum-=$wheel{$item}; } print "$item was picked\n";
I think that will work, if not, you should at least get the general idea.

G'Luck!
Gryn