hashToUnitInterval
function hashToUnitInterval(input, seed?): number;Defined in: hash.ts:82
Map a string deterministically onto the half-open unit interval [0, 1).
Used to pick a bucket within a split’s cumulative weight range.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
input |
string |
undefined |
seed? |
number |
0 |
Returns
Section titled “Returns”number
Example
Section titled “Example”import { hashToUnitInterval } from "@xtandard/flags";
const bucket = hashToUnitInterval("user-42"); // → e.g. 0.3141… (always in [0, 1))