MCPcopy Create free account
hub / github.com/codeaashu/claude-code / roll

Function roll

src/buddy/companion.ts:107–113  ·  view source on GitHub ↗
(userId: string)

Source from the content-addressed store, hash-verified

105// per-turn observer) with the same userId → cache the deterministic result.
106let rollCache: { key: string; value: Roll } | undefined
107export function roll(userId: string): Roll {
108 const key = userId + SALT
109 if (rollCache?.key === key) return rollCache.value
110 const value = rollFrom(mulberry32(hashString(key)))
111 rollCache = { key, value }
112 return value
113}
114
115export function rollWithSeed(seed: string): Roll {
116 return rollFrom(mulberry32(hashString(seed)))

Callers 1

getCompanionFunction · 0.85

Calls 3

rollFromFunction · 0.85
mulberry32Function · 0.85
hashStringFunction · 0.70

Tested by

no test coverage detected