Skip to the content

Houseki宝石

Run five native gem and stone engines, play measured challenges and lessons, and save deterministic games.

Houseki (宝石) is Japanese for a gem or precious stone. About the name

Contents

Reference · Falling Triplets

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

NameTypeDescription
statenumber

The immutable native state to read or transition; the input is retained.

nnumber

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/houseki 0.4.2.