initial
This commit is contained in:
16
utils/SeededRandom.js
Normal file
16
utils/SeededRandom.js
Normal file
@@ -0,0 +1,16 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user