Thursday, August 15, 2013

JavaScript math random

<html>
<body>

<script type="text/javascript">

//return a random number between 0 and 1
document.write(Math.random() + "<br />");

//return a random integer between 0 and 10
document.write(Math.floor(Math.random()*11));

</script>

</body>
</html>

Result


No comments: