Oslo

generateRandomInteger()

Generates a random integer between 0 (inclusive) and a positive integer (exclusive). Uses cryptographically strong random values.

Definition

function generateRandomInteger(max: number): number;

Parameters

  • max

Example

import { generateRandomInteger } from "oslo/crypto";

// random number from 0 to 9
generateRandomInteger(10);