ASP – An open application environment, it enables powerful server-side scripting.  Home Web Programming ASP Randomizer for ASP
Your Ad Here

Randomizer for ASP


Randomizer for ASPA randomizer is a powerful tool when scripting and programming.
Here is a simple but powerful one for ASP.

First of all you need to randomize something wich can be done by the command
Randomize.

You could either just ranomize a number out of nothing by just calling Randomize, but
I the way to create the "most random" number is to use the servers clock like this:

Randomize Timer

After calling Randomize, the number is stored in a variable called Rnd and is between
0,0 to 1,0.

Lets say you want to create a function to randomizer a number between 1 and 10.
This code should do it for you:

Function Random()
Randomize Timer
intRandomNumber = CLng( ( Rnd * 9 ) + 1 )
Random = intRandomNumber
End Function

Response.Write(Random())

Feel free to post any feedback.



Author's URL: Andrew
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Web programming � everything from the basics of visual design and architecture to the specifics of applications, graphics, and scripting. More Web Programming: Most Popular Materials | Fresh Materials | More ASP Tutorials at LearnPHP.org

Add comments to "Randomizer for ASP"

Only registered users can write comment

No comments yet...