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
| Name | Type | Description |
|---|---|---|
random | Random | A random source returning values in [0, 1). |
min | number | The included lower bound. |
max | number | 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.20220750384032726What it prints (run when this page was built)