Skip to content

random

Generates a random integer between bounds.

Usage

ts
import { random } from 'tsu'

random(5)
// 0, 1, 2, 3, or 4

random(2, 5)
// 2, 3, or 4

Type Definitions

ts
/**
 * @param min - The inclusive minimum bound.
 * @param max - The exclusive maximum bound.
 * @returns The random integer.
 */
function random(max: number): number
function random(min: number, max: number): number
function random(...args: number[]): number

Released under the MIT License.