JavaScript Random Number Generator

 

This simple script, will show you how to generate a random number in JavaScript.

If you decide you want to use or alter the script to suit your needs, please give your support and leave a link to this site, thanks.

Try it out! Every time the page is reloaded or has a refresh, a new random number is generated.

 

 

Example

Random number is:

 

 

Script Source

<script language="JavaScript">
random_num0 = (Math.round((Math.random()*9)+1))
random_num1 = (Math.round((Math.random()*9)+2))
random_num2 = (Math.round((Math.random()*9)+3))
random_num3 = (Math.round((Math.random()*9)+4))
random_num4 = (Math.round((Math.random()*9)+5))
document.write(random_num0);
document.write(random_num1);
document.write(random_num2);
document.write(random_num3);
document.write(random_num4);

</script>

 

Please let me know if this script was helpful to you.

[rating]