Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to generate random number from specific range

<script> 
  
// Function to generate random number 
function randomNumber(min, max) { 
    return Math.floor(Math.random() * (max - min) + min);
} 
  
document.write("Random Number between 1 and 100: ") 
  
// Function call
document.write( randomNumber(1, 100) ); 
</script>
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #How #generate #random #number #specific #range
ADD COMMENT
Topic
Name
6+2 =