Creating Random Numbers in FileMaker : SFR FileMaker Blog

Aan oldie but goodie…I needed this custom function in a project I worked on yesterday…

Creating Random Numbers in FileMaker

Leave a comment

7-14-2007 by Jesse Antunes

Read Next Post >><< Read Previous Post

Creating a random number with FileMaker is a seemingly impossible task. Fortunately for us, FileMaker provides us with a very useful calculation function to help us along the way: Random. Alas, this function isn’t quite what you think.

Random doesn’t just produce any old random number (if it did you definitely wouldn’t be reading this post). Random produces a number from 0 to 1 as a 20 digit decimal value! I know this sounds a little ridiculous and completely useless, but with a little finagling we can produce a usable random number from this giant decimal.

A better random function

Here’s the custom function that can calculate a random number in any range you want. You just pass in the smallest number you’re willing to accept, and the largest.

Name: RandomNumber

Parameters: Minimum, Maximum



Num = Int ( Random * ( Maximum – Minimum + 1 ) ) + Minimum;

If( Num =< Maximum and Num >= Minimum ; Num ; RandomNumber( Minimum, Maximum ) )


More… Creating Random Numbers in FileMaker : SFR FileMaker Blog.

Liked Liked
Need FileMaker Development Help? Or to purchase FileMaker Software?
Contact FM Pro Gurus for help