Javascript examples for jQuery:Number
Making math.random with float values
<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>