Skip to content

Commit

Permalink
Fix random index calculation in resetForm()
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Mar 30, 2018
1 parent f06d412 commit 8d86086
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/components/passphrase/confirm/index.js
Expand Up @@ -90,7 +90,6 @@ class Confirm extends React.Component {

resetForm() {
const words = this.props.passphrase.match(/\w+/g);
const indexByRand = num => Math.floor(num * (words.length - 1));

/**
* Returns a random index which doesn't exist in list
Expand All @@ -101,7 +100,7 @@ class Confirm extends React.Component {
const randomIndex = (list) => {
let index;
do {
index = indexByRand(Math.random());
index = Math.floor(Math.random() * words.length);
}
while (list.includes(index));
return index;
Expand Down

0 comments on commit 8d86086

Please sign in to comment.