0

I want to use javascript to generate 10 no-repeat random numbers and the number is in the range 1 to 10.how can I realize it?The 10 numbers stored in a array.

this the code i have but the numbers repeats itself

function myFunction() {
  var x = Math.floor((Math.random() * 9) + 1); 
   document.getElementById("question").innerHTML = Allquestion[x]; 
}
  • Just write the numbers 1 to 10 as that's the only result that fits your requirements. Or are you trying to get the numbers 1 to 10 in a random order? – RobG Mar 30 '16 at 02:11
  • Pretty sure the latter, since there's a requirement for no repeating, and random numbers... – Dave Newton Mar 30 '16 at 02:25

0 Answers0