Make the random seed it's own variable

This commit is contained in:
Steve Kinney
2024-09-30 13:21:00 -06:00
parent f3b1df89bc
commit 6ab5cba572

View File

@@ -5,7 +5,9 @@ export class Game {
* @param {number} maximum - The maximum number to guess.
*/
constructor(minimum, maximum) {
this.secretNumber = Math.ceil(Math.random() * maximum - minimum) + minimum;
const seed = Math.random();
this.secretNumber = Math.ceil(seed * maximum - minimum) + minimum;
this.guesses = new Set();
console.log(`Guess the number between ${minimum} and ${maximum}.`);