FUNCTION:  Rnd( )

Rnd(Number)
 
The Rnd function generates a pseudo-random number greater than or equal to 0.0 and less than 1.0.
 
The Number argument is optional, but different numbers will give different pseudo-random numbers.
 
Note that the number generated is pseudo-random, because the same output tends to be repeated over and over. You can use the Randomize statement to over come this problem.
 
Code:
<% =Rnd() %>
 
Output:
0.7055475
 
Code:
<% =Rnd(127.89) %>
 
Output:
0.533424
 
Code:
<% =Rnd(-127.89) %>
 
Output:
0.6953956
 
Code:
<% Randomize %>
<% =Rnd() %>

 
Output:
0.1414095
 
The following code will generate a random number between any limits you choose. (Since the Int function always rounds down, we add one to the difference between the limits.)
 
Code:
<% upperlimit = 50000.0 %>
<% lowerlimit = -30000.0 %>
<% =Int((upperlimit - lowerlimit + 1)*Rnd() + lowerlimit) %>

 
Output:
30366


Copyright 1999-2004 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information