Blondinka,
function getRandArr(arr, range) {
var tmp = {};
for (var i = 0; i < range; i++) {
arr.push(Math.floor(Math.random() * (range + 1)));
}
for (var i = 0; i < arr.length; i++) {
tmp[arr[i] + '.'] = 1;
}
if (Object.keys(tmp).length !== range) {
for (var i = 0; i < arr.length; i++) {
var newItem = Math.floor(Math.random() * (range + 1));
tmp[(arr[i] + newItem) + '.'] = 1
}
}
arr = Object.keys(tmp), count = arr.length;
while (count > range) {
count--;
arr.splice(count, 1);
}
arr = arr.join('').split('.');
arr.pop();
return arr;
}
alert(getRandArr([], 100));