UNPKG

fraction.io

Version:

Your personalized community aggregator.

17 lines (12 loc) 381 B
'use strict'; Utilities.shuffle = (array) => { var currentIndex = array.length, temporaryValue, randomIndex; while (0 !== currentIndex) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; };