Files
healer-man/src/game/dungeons/seededBossSelection.ts
T
2026-09-26 22:02:18 -04:00

10 lines
370 B
TypeScript

/** A run id selects one stable boss for saves and every member of a shared party. */
export function seededBossIndex(seed: string, candidateCount: number): number {
let hash = 0x811c9dc5;
for (let index = 0; index < seed.length; index += 1) {
hash ^= seed.charCodeAt(index);
hash = Math.imul(hash, 0x01000193);
}
return (hash >>> 0) % candidateCount;
}