Last active
April 9, 2018 13:28
-
-
Save nabrown/2ac45e448e145d7f40463ddb60bdb119 to your computer and use it in GitHub Desktop.
Another implementation of getRandosFromArray function, using shuffled array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getRandosFromArray = function(arr, numRandos){ | |
let arrClone = array.slice(0) | |
let shuffled = arrClone.sort(function() { return .5 - Math.random() }) | |
let randos = shuffled.slice(0, numRandos) | |
return randos | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment