Random
Purpose
Returns a number between 0 and 1, including 0 but not including 1.
Format
Random
Parameters
None
Data type returned
number
Originated in
FileMaker Pro 6.0 or earlier
Description
Returns a pseudo-random number in the range (0,1). FileMaker Pro generates a new random number when you:
•insert the
Random function into a
formula •cause a formula containing the Random function to be reevaluated (by changing data in any of the fields the formula uses)
Example 1
Int ( Random * 10 ) returns a random number from 0 to 9.
Example 2
Int ( Dice::NumSides * Random ) + 1 returns a randomly chosen side of a single die.
The following script calculates multiple die rolls, adds the rolls to a single variable, then displays the results in a custom dialog.
Loop
Set Variable [$ROLL; Value:$ROLL + ( Int ( Test::NumSides * Random ) + 1 )]
Set Variable [$COUNTER; Value:$COUNTER + 1]
Exit Loop If [$COUNTER = Dice::NumDice]
End Loop
Show Custom Dialog [$ROLL]
Related topics