xxxxxxxxxx
n = 5;
array = Array.from({ length: 50 }, (v, k) => k * 10); // [0,10,20,30,...,490]
var shuffled = array.sort(function(){ return 0.5 - Math.random() });
var selected = shuffled.slice(0,n);
document.querySelector('#out').textContent = selected.toString();