MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / seedFrom

Function seedFrom

packages/react/src/components/artifact-preview.tsx:60–67  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

58
59/** FNV-1a over the id — a stable, well-mixed seed from an opaque string. */
60const seedFrom = (value: string): number => {
61 let hash = 2_166_136_261;
62 for (let index = 0; index < value.length; index += 1) {
63 hash ^= value.charCodeAt(index);
64 hash = Math.imul(hash, 16_777_619);
65 }
66 return hash >>> 0;
67};
68
69/**
70 * mulberry32 — a tiny deterministic PRNG.

Callers 2

artifactPreviewFigureFunction · 0.85
ArtifactSchematicFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected