forked from phenom/healer-man
10 lines
370 B
TypeScript
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;
|
|
}
|