Brian Dunning's FileMaker Custom Functions

RandomInteger ( start ; stop )

Generates a signed random integer value.

  Average rating: 4.4 (31 votes) Log in to vote

Kalle Samuelsson   Kalle Samuelsson
Premium System
http://www.premium.se

Share on Facebook Share on Twitter

  Sample input:
RandomInteger ( 1; 5 )
RandomInteger ( -5; -1 )
RandomInteger ( -5; 5 )
  Sample output:
3
-2
0

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function generates a random signed interger value (or acctually as big a number as FMP allows it to be) streching across zero if a negative start-param and positiv stop-param is givven.
The value returned will be inside or equal to the start and stop params sent to the function. The stop-param must always be larger then the start param!

I commonly use this function as an addition to script step "GoToRecord[ NumberByCalculation ]" wich make a easy way of selecting a random record. The function call would the look like this:

RandomInteger( 1 ; get(foundcount) )

Simple but effective, enjoy!

 

Comments

Eli   Eli, California
Sep 28, 2016
Excellent! Thank you very much
 
Magnus   Magnus, Göteborg
Apr 5, 2017
Just what I needed. Thanks mate!
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.