MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / createRng

Function createRng

examples/data-update-animation/main.ts:20–27  ·  view source on GitHub ↗
(seed: number)

Source from the content-addressed store, hash-verified

18 * Small deterministic RNG (LCG) for repeatable "random" transitions.
19 */
20const createRng = (seed: number): (() => number) => {
21 let s = (seed >>> 0) || 1;
22 return () => {
23 // Numerical Recipes LCG constants
24 s = (1664525 * s + 1013904223) >>> 0;
25 return s / 0xffffffff;
26 };
27};
28
29const clamp = (v: number, min: number, max: number): number => Math.max(min, Math.min(max, v));
30

Callers 2

mainFunction · 0.85
updateChartsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected