Reference · Streams, draws and seeds
normalfunction
A number from a normal distribution (Box–Muller): two draws.
Import it
import { normal } from "@johnmorrisdotca/tane";
Definition
function normal(random: Random, mean?: number, spread?: number): number
Parameters
| Name | Type | Description |
|---|---|---|
random | Random | A random source returning values in [0, 1). |
mean (optional) | number | The normal distribution’s mean. |
spread (optional) | number | The normal distribution’s standard deviation. |
Returns
number
A number from a normal distribution (Box–Muller): two draws.
Examples
import { mulberry32, normal } from "@johnmorrisdotca/tane";
const random = mulberry32(42);
console.log(normal(random, 10, 2));8.087675541231702What it prints (run when this page was built)