| 359 | // We build a hash seed based on: unique chat file, raw content, and the placement inside this content | 359 | // We build a hash seed based on: unique chat file, raw content, and the placement inside this content |
| 360 | // This allows us to get unique but repeatable picks in nearly all cases | 360 | // This allows us to get unique but repeatable picks in nearly all cases |
| 361 | const combinedSeedString = `${chatIdHash}-${rawContentHash}-${offset}`; | 361 | const combinedSeedString = `${chatIdHash}-${rawContentHash}-${offset}`; |
| 362 | const finalSeed = getStringHash(combinedSeedString).toString(); | 362 | const finalSeed = getStringHash(combinedSeedString); |
| | 363 | // @ts-ignore - have to use numbers for legacy picks |
| 363 | const rng = seedrandom(finalSeed); | 364 | const rng = seedrandom(finalSeed); |
| 364 | const randomIndex = Math.floor(rng() * list.length); | 365 | const randomIndex = Math.floor(rng() * list.length); |
| 365 | return list[randomIndex]; | 366 | return list[randomIndex]; |