osric-cgi/lib/OSRIC/Util.pm
2015-01-22 14:16:32 +00:00

20 lines
283 B
Perl

package OSRIC::Util;
use Exporter qw/import/;
our @EXPORT = qw/d/;
# Rolls a dice of the specified number:
sub d
{
# 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;
}
1;