This site provides users with the information about asp, create random number, how to generate random number, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to creat a random number in asp?
There are many situations that you need to generate a random number when you program with ASP script. For example, alternating ads or displaying greetings.
The first thing that you need to do is to use:
Without it, it will generate the same sequence of numbers because the the computer does not know where to "start".
The next thing that you need do is us "Rnd" variable. If you do not want the decimal points, you can use "Int". The following is the formula that you can use:
randNo = Int((9 * Rnd) + 1)
With the above statement, you can generate a random number between 1 and 10 without deciaml points. You would multiply that starting number by 9, and add 1 so that a 0 turned into a 1, a 1 into a 2 and so on. The lowest number it could create would be 1 (0 + 1), and the highest number would be 10 (9 + 1).