nextIntfunction
Draws an unbiased integer and updated state using rejection sampling.
Import it
import { nextInt } from "@johnmorrisdotca/houseki/falling-triplets";
Definition
function nextInt(state: number, n: number): readonly [number, number]
Parameters
| Name | Type | Description |
|---|---|---|
state | number | The immutable native state to read or transition; the input is retained. |
n | number | The positive upper bound of the integer draw; the result is below this bound. |
Returns
readonly [number, number]
Draws an unbiased integer and updated state using rejection sampling.
Examples
import { nextInt, seedState } from "@johnmorrisdotca/houseki/falling-triplets";
console.log(nextInt(seedState("docs"),6));[ 0, 2153459370 ]What it prints (run when this page was built)