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

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

NameTypeDescription
randomRandom

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

minnumber

The included lower bound.

maxnumber

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));
4

What it prints (run when this page was built)

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