Find the random number in a range : Random « Language Basics « JavaScript DHTML






Find the random number in a range

   


<html>
<head>
<title>Random Quote</title>
<script type="text/javascript">
function getQuote() {
   do {
     iValue = Math.random(); 
     document.write(iValue+"<BR>");
     iValue *= 10; 
     document.write(iValue+"<BR>");
     iValue = Math.floor(iValue); 
     document.write(iValue+"<BR>");
   }
   while (iValue > 4) 
   document.write(iValue);
}
getQuote();
</script>
</head>
<body>
</body>
</html>

   
    
    
  








Related examples in the same category

1.Unique Random Numbers
2.Unique Random Sets
3.Math Random number: a random number between 0 and 1
4.Random number from 0 to 10: a random number from 0 to 10 using the random() and round()
5.Random link
6.A Random Ad Display Page
7.Random URL