Skip to content

Commit

Permalink
possible solution for secureRandomNumber but I think it'll create sec…
Browse files Browse the repository at this point in the history
…urity problems.
  • Loading branch information
uo288574 committed Apr 27, 2024
1 parent 39d360c commit 277f9c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions webapp/src/components/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ function shuffleArray(array) {
}

function secureRandomNumber(max) {
if (!window.crypto) {
return Math.floor(Math.random() * max);
}
const randomBytes = new Uint32Array(1);
window.crypto.getRandomValues(randomBytes);
return randomBytes[0] % max;
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/game/Calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const Calculator = () => {
<div class="questionCalculator">

<Typography class="questionText" component="h1" variant="h5" sx={{ textAlign: 'center' }}>
{generateQuestion()}
{setQuestion(generateQuestion())}
{question.q}
</Typography>

Expand Down

0 comments on commit 277f9c9

Please sign in to comment.