The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

fun.roll

Random number generator, including functionality for obtaining numbers in the style of arbitrary-sided dice-rolling.

roll

Description

Given a die-size and a number of rolls, returns the summed result of all those rolls. Each roll is effectively a call to ``(random n)`` where ``n`` is your die size.

Assumes a single roll if you don't specify otherwise.

Usage

<die size> [<roll count>]

Examples

(roll 20)
(roll 4 3)

random

Description

Returns a random integer between ``0`` and ``max`` (defaults to 1).

Usage

[<max>]

Examples

(random 10)