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

floatfunction

A number in [min, max): one draw.

Import it

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

Definition

function float(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

A number in [min, max): one draw.

Examples

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

const random = mulberry32(42);
console.log(float(random, -1, 1));
0.20220750384032726

What it prints (run when this page was built)

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