Resetting Math.random() - Chore Door Project

Hello everyone,

I am building my Chore-Door project in a different way, using Math.random() but I am finding it hard to re-initialize the current number generated when the user presses ‘Play Again’. The number generated won’t change until the browser is reloaded. Is there a way to reset the number generated without reloading the browser?

The simplest way would be to run a program loop.

Yes, you can generate the random nr again without reloading the browser. That is the way that the project was designed. The startButton has an onclick handler. This onclick-function calls the startRound() function. The startRound() function calls randomChoreDoorGenerator()(which uses Math.random). The startButton is only enabled when there is not a current game in progress.

The main thing will be to connect a button to a function that uses Math.random() in a similar way to the logic above and then displays the result.