Random::Time returns a random time unit, random day part, random time, or random frequency.
This document describes Random::Time version 1.000.
use Random::Time qw(random_time_unit random_day_part random_time random_frequency);
my $time_unit = random_time_unit;
my $standard_time_unit = random_time_unit('general');
my $game_time_unit = random_time_init('game');
print random_time_unit('help')
my $day_part = random_day_part;
my $time = random_time;
my $standard_time = random_time('general');
my $game_time = random_time('game');
my $frequency = random_frequency;
Random::Time returns a random time unit, random day part, random time, or random frequency. You need to import the functions into your script.
random_time_unit
returns a random unit of time from a second to a millennium. It has two optional parameters: the list option and any units of time you want to add to the list.
random_time_unit;
random_time_unit();
random_time_unit('all');
random_time_unit(undef);
These options return any value in any list. You can read the options below to see all of the potential values.
random_time_unit('general');
The general
option returns second, minute, hour, day, week, month, year, decade, century, or millennium.
random_time_unit('game');
The game
option returns segment, round, or turn.
random_time_unit('by keys');
The by keys
option will select a random key listed above.
random_time_unit('keys');
The keys
option will list all of the available keys in an array reference.
random_time_unit('data');
The data
option will return the data used in a hash reference.
random_time_unit('help');
random_time_unit('options');
The help
or options
options will return a list of all of your options.
my @additions = ('time unit 1', 'time unit 2');
random_time_unit('<your option>', \@additions);
You can add items to the list by adding an array reference with the additional items as the second parameter.
random_day_part
returns a random part of the day and has no parameters. If the part of the day is morning, afternoon, or evening; the returned string will read "in the morning", "in the afternoon", or "in the evening". The the part of the day is dawn, midmorning, noon, midday, dusk, night, or midnight; the returned string will read "at dawn", "at midmorning", "at noon", "at midday", "at dusk", "at night", or "at midnight".
random_time
returns a random time and has one parameter. It combines random_time_unit
with random_day_part
. Time units that are a day or shorter will return just the time unit, every other time unit will be suffixed with a day part phrase. There are sixty-eight possible combinations, so I will not list them all here, but I will give a few examples of the output.
hour
century in the afternoon
decade at night
week in the morning
segment
See the description for nothing, all
, or undef
in random_time_unit
.
See the description for general
in random_time_unit
.
See the description for game
in random_time_unit
.
random_frequency
returns a random frequency for when something could happen from one time to twenty times a time unit. It has no parameters.
5 times a year
3 times a month
7 times an hour
2 times a century
13 times a round
Random::Time depends on Fancy::Rand, Random::SpecialDice, Lingua::EN::Inflect, and Exporter.
Lady Aleena
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
Copyright © 2020, Lady Aleena (aleena@cpan.org)
. All rights reserved.