MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / hashString

Function hashString

ai-code-studio/src/buddy/companion.ts:25–32  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

23}
24
25function hashString(s: string): number {
26 let h = 2166136261;
27 for (let i = 0; i < s.length; i++) {
28 h ^= s.charCodeAt(i);
29 h = Math.imul(h, 16777619);
30 }
31 return h >>> 0;
32}
33
34function pick<T>(rng: () => number, arr: readonly T[]): T {
35 return arr[Math.floor(rng() * arr.length)]!;

Callers 1

rollFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected