Skip to the content

Tane種

Reproduce numbers from a seed, shuffle or pick items, share a daily puzzle and resume a saved stream.

Tane means seed in Japanese. About the name

Contents

Reference · Streams, draws and seeds

belowfunction

An integer in [0, n): one draw.

Import it

import { below } from "@johnmorrisdotca/tane";

Definition

function below(random: Random, n: number): number

Parameters

NameTypeDescription
randomRandom

A random source returning values in [0, 1).

nnumber

The exclusive upper bound for an integer draw.

Returns

number

An integer in [0, n): one draw.

Examples

import { below, mulberry32 } from "@johnmorrisdotca/tane";

const random = mulberry32(42);
console.log(below(random, 6));
3

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/tane 1.3.0.