Skip to content
velt/random exports

velt/random

API reference

Fast pseudo-random numbers like Math.random(), for simulations, sampling, shuffling, jitter and load generation. Not for secrets or tokens: use velt/crypto's randomBytes / randomInt for those. For a walkthrough, read the guide.

import { random, randomInt } from "velt/random";

Exports

Re-exported from velt/random/prng

function random(): f64

A number in [0, 1) (53 random bits), like Math.random().

function

randomInt

#std/random/prng.vlt:11

Re-exported from velt/random/prng

function randomInt(min: i64, max: i64): i64

An integer in [min, max), uniformly distributed; min when max <= min.