Returns a number between 0 and 1, including 0 but not including 1.
Random
None
number
FileMaker Pro 6.0 or earlier
Returns a pseudo-random number in the range (0,1). FileMaker Pro Advanced 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)
•display or access a calculation field defined to have an unstored result
Int ( Random * 10 )
returns a random number from 0 to 9.
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]