* Randomize array element order in-place. * Using Durstenfeld shuffle algorithm. * source: http://stackoverflow.com/a/12646864/1324039
(array)
| 44 | * source: http://stackoverflow.com/a/12646864/1324039 |
| 45 | */ |
| 46 | shuffleArray(array) { |
| 47 | for (let i = array.length - 1; i > 0; i--) { |
| 48 | let j = Math.floor(Math.random() * (i + 1)); |
| 49 | let temp = array[i]; |
| 50 | array[i] = array[j]; |
| 51 | array[j] = temp; |
| 52 | } |
| 53 | return array; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * |
no outgoing calls
no test coverage detected