CONCERN: The following function does what it is suppose to do -- namely, select at random and without duplication a given number of elements from an array of elements. However, I fear that it is hopelessly awkward and would like your professional assessment of its construction. You will likely not find another like it on the internet, but parts of it were obtained therefrom.
function selectCubes(gates) {
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
var cubes = ['cube_one', 'cube_two', 'cube_three', 'cube_four', 'cube_five', 'cube