rand
Top  Previous  Next

rand ( integer Max)

Use this function to generate a pseudorandom integer in the range of 0 to Max. To initialize the random number generator, use
randomize.

Parameters

Max  
 
A positive integer specifying the maximum value for the randomization range.  
 
Return value
 
The pseudorandom integer number.  
 
Examples
 
This set of statement prints a unique series of pseudo-random numbers each time you run the script:  
 
randomize()  
For I=0 To 100  
Print rand(100)  
Next  
 
This set of statement repeatedly draws a text string of a random color at a random location on an image:  
 
createIm (1,IM_RGB,512,512)  
do  
 r=rand(255)  
 g=rand(255)  
 b=rand(255)  
 drawText(1, "imageWarp", rand(getImWidth(1)), rand(getImHeight(1)),r,g,b)  
loop