Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

<rand />

The <rand /> element is used to generate a random integer within a specified range.

Attributes

  • min (int, optional): The minimum value of the range (inclusive). Defaults to 0.
  • max (int, optional): The maximum value of the range (inclusive). Defaults to Rust's i64::MAX.

Example

<program>
    <print>
        Random number between 1 and 10: <space /> <rand min="1" max="10" />
    </print>
</program>