Random Function


the random of <upperlimit> or
random (<upperlimit>)


The random function returns a randomly selected integer between 1 and <upperlimit>, inclusive. The random number generator is automatically seeded from the outset, so it always returns a new sequence. If you need to generate a predictable sequence for testing purposes, use the setRandomSeed command.


To get a random number within a specified range from <lowerlimit> to <upperlimit>, use the following syntax:


The following function computes a random integer between two specified integers when passed the lesser of the two numbers as its first parameter and the greater of the two as its second parameter: function random2 lower,upper return random(upper-lower+1) + lower -1 end random2 Place the function just described into the script of a stack and test it by typing the following in the Message Box: random2 (10, 15) A number between 10 and 15, inclusive, is returned. random2 (-5, 5)
This text has been mechanically extracted from the Oracle Media Objects MediaTalk Reference, © 1995 Oracle Corporation, and is provided here solely for educational/historical purposes.