randomInt

Built-ins

Canonical ID: random.integer. Nederlands: willekeurigGeheel.

Returns one whole number within the inclusive interval. Equal bounds always return that bound. The random stream is deterministic for a given runtime run; do not use this educational random function for passwords, security tokens, or cryptographic keys. Bounds must already be whole numbers; they are not rounded.

Signature

randomInt(minimum, maximum)

Arguments

Parameter Type Requirement
minimum Number Whole number, at least -1,000,000,000; no greater than maximum.
maximum Number Whole number, at most 1,000,000,000.

Return value

Number.

Example

# language: en
let die = randomInt(1, 6)
say die >= 1 and die <= 6
say randomInt(4, 4)

Prints true and 4.

Notes and common mistakes

Use the function name for your source language. Its canonical ID is a shared documentation label; you do not type that ID as a call. Giving your own variable or function the same name can hide the built-in. Supply the documented arguments and value types. Pliro reports mismatches when checking can detect them, or when the call runs.

Programming guides · Host support · Calls and arguments