2015-01-07 11:13:22 -05:00
|
|
|
package OSRIC::Util;
|
2015-01-22 09:16:32 -05:00
|
|
|
use Exporter qw/import/;
|
|
|
|
our @EXPORT = qw/d/;
|
2015-01-07 11:13:22 -05:00
|
|
|
|
|
|
|
# Rolls a dice of the specified number:
|
|
|
|
sub d
|
|
|
|
{
|
2015-01-22 09:16:32 -05:00
|
|
|
# The range of the dice:
|
|
|
|
my $range = shift;
|
|
|
|
|
|
|
|
# Optional: The number of dice thrown.
|
|
|
|
my $n = shift // 1;
|
|
|
|
|
|
|
|
my $i = 0;
|
|
|
|
$i += int(rand($range));
|
|
|
|
return $i;
|
2015-01-07 11:13:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|