| 44 | } |
| 45 | |
| 46 | function shuffle(array) { |
| 47 | let randomIndex; |
| 48 | let temporaryValue; |
| 49 | const length = array.length; |
| 50 | array.forEach((item, currentIndex, array) => { |
| 51 | randomIndex = Math.floor(Math.random() * length); |
| 52 | temporaryValue = array[currentIndex]; |
| 53 | // eslint-disable-next-line no-param-reassign |
| 54 | array[currentIndex] = array[randomIndex]; |
| 55 | // eslint-disable-next-line no-param-reassign |
| 56 | array[randomIndex] = temporaryValue; |
| 57 | }); |
| 58 | return array; |
| 59 | } |
| 60 | |
| 61 | function timeDiff(startTime) { |
| 62 | const timeArray = process.hrtime(startTime); |