So this fails the easy to remember requirement, but I coded this up at a
previous PLUG meeting so I though I would included it.
#!/usr/bin/perl
use strict;
my $limit = $ARGV[0];
unless ( $limit ) { die "Please specify a limit ex: ./grab_bag_generator.pl
25\n";}
my %seen = ();
my $run = 1;
while ($run) {
my $num = int(rand($limit)) + 1;
unless ( $seen{$num} ) {
print "$num\n";
$seen{$num}++;
print "Run again? (yn) ";
$_ = <STDIN>;
chomp;
if ( $_ =~ m/[nN]/ ) {
$run = 0;
}
}
if ( scalar(keys %seen) >= ($limit) ) { $run = 0 }
}
-James
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/