Samik,
<script>
function gn(b, d, c) {
for (var a = []; b <= d; b++) a = a.concat(a.splice(Math.random() * a.length | 0, 1, b));
return function() {
return a.length >= c ? a.splice(a.length - c) : a.splice(0)
}
};
var x = gn(0,10,3)
for (var i=0; i<5; i++) {document.write(x()+"<br>")}
</script>
|