0

I want to output 20 elements randomly from 5 to 100 but all of them different from each others. I created this code in javascript which doesnt output anithing.

 
 var b=new Array(20);
 var found =false;
 for(var i=0;i<b.length;i++){
  while(!found){
b[i]=Math.floor(6+Math.random()*94))
 found=true; 
  
  }
 document.writeln( b[i]+"<br />");
 }

Can someone help me to fix the code in js in a way that all the numbers to be different from each other? Thanks

Doen
  • 33
  • 1
  • 1
  • 6

0 Answers0