[an error occurred while processing this directive]
 | Forms Processor Advanced Commands |
Contents
Index of Commands
Search the Forms Processor Docs
srand
Randomize the random number generator, helps in producing a more random number.
- $dummy = srand(n);
-
- $dummy - A dummy variable, it is only needed for the function to work, it is not used.
- n - A seed value that you can use to make the random number generator return the same value each time. This value is not required, in general, it should be omitted.
- NOTE:
Use this function before using the rand function for the first time in your Form Processor configuration file.
Example:
#Randomize and generate some dice rolls
$Dummy_Value=srand();
$DiceRoll1=int(rand(6))+1;
$DiceRoll2=int(rand(6))+1;
format screen
<HTML>
<HEAD>
<TITLE>Random Numbers - Results of Die Roll</TITLE>
</HEAD>
<BODY>
<H1>Results of Die Roll</H1>
Die one: $DiceRoll1<br>
Die two: $DiceRoll2<br>
</BODY>
</HTML>
.
See also: int(n) function rand(n) function
[an error occurred while processing this directive]