Friday, 6 October 2017

Javascript Random Number

Math.random function is use to generate random number. It generates a long series of number less than one or zero. To get random number from a range you need to extract numbers as your requirement by round-off.

Following code demonstrate to generate number from 1 to 100.

     <title>Girfa Student Help : Random Number</title>
          function getRandom()
          function getRandomRange()
<h1 align="center">Random Number </h1><hr />
<input type="button" value="Generate" onclick="getRandom()" />
<input type="button" value="Between 1 to 100" onclick="getRandomRange()" />