Add srand() to handle fn for Goodies using rand()
parent
bee7bc01f3
commit
39fae8a17c
|
@ -71,6 +71,8 @@ sub shorthand_roll_output {
|
|||
}
|
||||
|
||||
handle remainder_lc => sub {
|
||||
# Ensure rand is seeded for each process
|
||||
srand();
|
||||
my @values = split(' and ', $_);
|
||||
my $values = @values; # size of @values;
|
||||
my $out = '';
|
||||
|
|
|
@ -21,6 +21,9 @@ attribution github => [ 'https://github.com/UnGround', 'Charlie Belmer' ],
|
|||
web => ['http://www.charliebelmer.com','Charlie Belmer'];
|
||||
|
||||
handle remainder => sub {
|
||||
# Ensure rand is seeded for each process
|
||||
srand();
|
||||
|
||||
my $address = join(':', map {sprintf '%0.2X', rand(255)}(1..6));
|
||||
|
||||
my $text_response = "Here's a random MAC address: $address";
|
||||
|
|
|
@ -18,6 +18,9 @@ attribution github => ['http://github.com/nospampleasemam', 'nospampleasemam'],
|
|||
web => ['http://dylansserver.com/', 'Dylan Lloyd'];
|
||||
|
||||
handle query_parts => sub {
|
||||
# Ensure rand is seeded for each process
|
||||
srand();
|
||||
|
||||
my $numericalized = str2nbr($_);
|
||||
return unless $numericalized =~ /^(\d{1,50}) (letter|char|character) words?$/;
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ topics 'entertainment';
|
|||
my @quotes = share('quotes.txt')->slurp;
|
||||
|
||||
handle query => sub {
|
||||
# Ensure rand is seeded for each process
|
||||
srand();
|
||||
|
||||
return if $_ !~ m/quotes?/;
|
||||
my $rand = int(rand(scalar(@quotes)));
|
||||
my $quote = $quotes[$rand];
|
||||
|
|
Loading…
Reference in New Issue