Populate an Array with Random and Unique Values Using JavaScript
May 5th, 2012
I recently had the need to take a JavaScript array that contained 4 items, and create a new array of 3 random and unique items which would be populated from the values in the original 4 item array. I figured I would post an example of my solution for anyone who might need to do something similar. Though I’m not going detail to explain everything in this post, my example is heavily commented for anyone interested in how this snippet of code works…