let pinIdArray = ["448460075380400214", "554857616577037440", "129619295506364205", "3403722138", "8005795986", "7717201977", "6689430878", "7705363504", "3827905985", "9133621064", "9162201846", "2655432017", "0197893312", "7220269979", "3218703261", "3478813716", "7445481990", "9806757977", "9357022147", "3492330721", "3504169963", "9259212333", "6574699545", "9727263383", "0016479256", "1624997250", "2083975447", "5683391989", "3466001901", "4660933902", "5216511997", "8820216343", "8583764035", "4563326839", "5201961267", "3429608185", "5007846054", "7437408815", "3472117054", "1545827364", "3152159572", "7913372317", "2550237417"];
function getRandomSubset(array, setSize) {
let maxValue = array.length, tmpSet = new Set(), randomIndices;
if (maxValue <= setSize) {
randomIndices = [...Array(setSize).keys()];
} else {
while (tmpSet.size < setSize) {
tmpSet.add(Math.floor(Math.random() * maxValue));
}
randomIndices = Array.from(tmpSet)
}
return randomIndices.map(index => array[index]);
}
//function(){
// res.render("suggested", {pins: getRandomSubset(pinIdArray, 25)});
// Test
console.log("25 Random Elements:", getRandomSubset(pinIdArray, 25));