Skip to content

Commit

Permalink
Merge pull request #652 from webmaster128/rnd-index
Browse files Browse the repository at this point in the history
Fix random index calculation in resetForm() - Closes #651
  • Loading branch information
reyraa authored Apr 4, 2018
2 parents 8fa5757 + 8d86086 commit 829125e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/components/passphrase/confirm/index.js
Original file line number Diff line number Diff line change
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 829125e

Please sign in to comment.