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

Function rollFrom

src/buddy/companion.ts:91–102  ·  view source on GitHub ↗
(rng: () => number)

Source from the content-addressed store, hash-verified

89}
90
91function rollFrom(rng: () => number): Roll {
92 const rarity = rollRarity(rng)
93 const bones: CompanionBones = {
94 rarity,
95 species: pick(rng, SPECIES),
96 eye: pick(rng, EYES),
97 hat: rarity === 'common' ? 'none' : pick(rng, HATS),
98 shiny: rng() < 0.01,
99 stats: rollStats(rng, rarity),
100 }
101 return { bones, inspirationSeed: Math.floor(rng() * 1e9) }
102}
103
104// Called from three hot paths (500ms sprite tick, per-keystroke PromptInput,
105// per-turn observer) with the same userId → cache the deterministic result.

Callers 2

rollFunction · 0.85
rollWithSeedFunction · 0.85

Calls 3

rollRarityFunction · 0.85
pickFunction · 0.85
rollStatsFunction · 0.85

Tested by

no test coverage detected