HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
The Rnd function returns a random number. The number is always less than 1 but greater or equal to 0."
A random number:
<%
response.write(Rnd)
%>
Note that you will get the same number every time. To avoid this, use the Randomize statement like in Example 2
The output of the code above will be:
0.7055475
To avoid getting the same number every time, like in Example 1, use the Randomize statement:
<%
Randomize
response.write(Rnd)
%>
The output of the code above will be:
0.4758112
Here is how to produce random integers in a given range:
<%
Dim max,min
max=100
min=1
Randomize
response.write(Int((max-min+1)*Rnd+min))
%>
The output of the code above will be:
71
❮ Complete VBScript Reference