Making math.random with float values - Javascript jQuery

Javascript examples for jQuery:Number

Description

Making math.random with float values

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from   w  ww  .  j a v a2 s.c  o m*/
function my(value) {
    var rollvalue = Math.random();
    $('.result').text(rollvalue);
    return value >= rollvalue;
}
console.log(0.01,my(0.01));
    });

      </script> 
 </head> 
 <body> 
  <div class="result"></div>  
 </body>
</html>

Related Tutorials