Files
amazon-city-of-gold/utils/SeededRandom.js
Andrey Sharshov 9487728656 initial
2025-11-16 18:54:31 +01:00

17 lines
343 B
JavaScript

export class SeededRandom {
constructor(seed) {
this.seed = seed;
}
// Generates a random number
next() {
this.seed = (this.seed * 9301 + 49297) % 233280;
return this.seed / 233280;
}
// Generates a random integer within a range
nextInt(min, max) {
return Math.floor(this.next() * (max - min + 1)) + min;
}
}