random number




JavaScript Source Code 3000: Messages: Random Number









































Random Number







Pass a range of numbers to this JavaScript function and it will return a random number within that range. For example, passing the range of [1, 158] would return a number such as 37, 141, 18, etc. Awesome!








(Hit reload to get a new random number)




JavaScript Source Code 3000: Messages: Random Number
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!





    





<!-- TWO STEPS TO INSTALL RANDOM NUMBER:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Ronnie T. Moore -->
<!-- Web Site: JavaScript Source Code 3000 -->
<!-- Based on code by: Cyanide_7 -->

<! >
<! >

<!-- Begin
function getRandomNum(lbound, ubound) {
return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}
// End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
document.write("Random number in [1, 158]: ");
document.write(getRandomNum(1,158));
// End -->
</script>



<!-- Script Size: 0.94 KB -->










Wyszukiwarka

Podobne podstrony:
random number
Uniform Random Number
random number
Random Number
NumberAndDateFormatting csproj FileListAbsolute
docs Nebula Fix Numbers
NumberFormatProvider
Regardie I Enochian Numbers
Random?ts of Kindness
EC vocabulary numbers 0 20 E with KEY
NumberUp
random
random jokes
numberofassessors

więcej podobnych podstron