function select(start,end){ var total = end - start + 1; return Math.floor(Math.random()*total + start); } for(var i=0;i<10;i++){ document.write(select(0,5)) document.write("") }