sonntagausgang,
Вариант...
var a = [,,,3,,,6,,8,9,10,11,12,13,14,15,16,17,18,];
function get(arr, e) {
for (var d = Array(arr.length), c = [], a = 0; a < arr.length; a++) if (a in arr) {
var f = Math.floor(Math.random() * (c.length + 1));
c.splice(f, 0, a)
}
for (a = 0; a < e; a++) d[c[a]] = arr[c[a]];
return d
};
alert([a,get(a,3),get(a,3),get(a,3),get(a,2),get(a,2),get(a,1),get(a,1)].join('\n'))