MCPcopy
hub / github.com/nusu/avvvatars / mash

Method mash

src/lib/alea.ts:24–37  ·  view source on GitHub ↗
(data: string)

Source from the content-addressed store, hash-verified

22 if (this.s2 < 0) { this.s2 += 1; }
23
24 function mash(data: string) {
25 data = String(data);
26 for (let i = 0; i < data.length; i++) {
27 n += data.charCodeAt(i);
28 let h = 0.02519603282416938 * n;
29 n = h >>> 0;
30 h -= n;
31 h *= n;
32 n = h >>> 0;
33 h -= n;
34 n += h * 0x100000000; // 2^32
35 }
36 return (n >>> 0) * 2.3283064365386963e-10; // 2^-32
37 }
38 }
39
40 next() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected