MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / mulberry32

Function mulberry32

scripts/fungrim/sample.ts:15–24  ·  view source on GitHub ↗
(seed: number)

Source from the content-addressed store, hash-verified

13
14/** mulberry32 — small deterministic PRNG */
15export function mulberry32(seed: number): () => number {
16 let a = seed >>> 0;
17 return () => {
18 a |= 0;
19 a = (a + 0x6d2b79f5) | 0;
20 let t = Math.imul(a ^ (a >>> 15), 1 | a);
21 t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
22 return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
23 };
24}
25
26/** FNV-1a over a string — derive a per-entry seed so results are independent
27 * of iteration order. */

Callers 1

generateAssignmentsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected