Insert this code between the <HEAD> tag and </HEAD> tag of your HTML page:
<SCRIPT> <!-- // Script by Howard Chen // Script compatible with Internet Explorer 2.0 or above // Netscape Navigator 2.0 or above // Get more JavaScripts at http://www.geocities.com/SiliconValley/Network/7432/ // Bugs report to hchen007@geocities.com // This script is free as long as the credit above is kept
function randomNum(str,stp) {
var temp = Math.round(Math.random() * (stp-str) + str)
return temp
}
//-->
</SCRIPT>
You can use randomNum() function
to take place of any Math.random() you might need.
An example of using this will be randomNum(1000,2000),
then a random number between 1000 and 2000 will return. An example
of using this will be document.write(randomNum(1000,2000))
and a number between 1000 and 2000 will be printed out.
IMPORTANT: The scripts provided in this page are free as long as you keep the credits in the code. E-mail me or use Script Rebuild Service for additional help about Cut N Paste or to ask for a script that is just for you.