Skip to main content

randomInt

Function randomInt 

Source
pub fn randomInt(min: i64, max: i64) -> i64
Expand description

Generates a random integer in an inclusive range.

§Arguments

  • min - Minimum value (inclusive)
  • max - Maximum value (inclusive)

§Returns

A random integer in the range [min, max].

§Panics

Panics if min > max.

§Example

use logicaffeine_system::random;

let dice = random::randomInt(1, 6); // 1, 2, 3, 4, 5, or 6
assert!((1..=6).contains(&dice));