Reference · Streams, draws and seeds
intfunction
An integer from min to max, both included: one draw.
Import it
import { int } from "@johnmorrisdotca/tane";
Definition
function int(random: Random, min: number, max: number): number
Parameters
| Name | Type | Description |
|---|---|---|
random | Random | A random source returning values in [0, 1). |
min | number | The included lower bound. |
max | number | The upper bound; included for int and excluded for float. |
Returns
number
An integer from min to max, both included: one draw.
Examples
import { int, mulberry32 } from "@johnmorrisdotca/tane";
const random = mulberry32(42);
console.log(int(random, 1, 6));4What it prints (run when this page was built)