random только 20 раз и никаких повторов
<script>
Array.prototype.shuffle = function() {
for (var a = this.length; 0 <= a; a--) {
var b = Math.floor(Math.random() * (10 > a ? 3 : a + 1)),
c = 10 > a || void 0 === this[b] ? b : this[b];
10 < a && (this[b] = void 0 === this[a] ? a : this[a]);
this[a] = c
}
return this.reverse()
};
var arr = new Array(20).shuffle();
document.write(arr+"<br>"+arr.join(''))
</script>