Skip to content

Randomness

This page lists examples of working with random numbers, uncertainty and randomness in general.

How to generate a random number

// Declare a variable to store the random number
let number: Int = 0;
// Generate a new random number, which is an unsigned 256-bit integer
number = randomInt();
// Generate a random number between 1 and 12
number = random(1, 12);
▶️ Open in Web IDE