AnsweredAssumed Answered

Random function is not very random

Question asked by PaulDSprague on Apr 7, 2009
Latest reply on Jul 9, 2010 by TSGal


Random function is not very random

Description of the issue

FileMaker Product(s) involved:FileMaker Pro 8.5 -> 10Operating System(s) involved:Mac 10.5.6 - Works reliably on multiple MacBook Pro 17" 2.4GHz machines, can't reproduce on a Mini 1.83GHz (also 10.5.6) or Windows.  I have had reports (but have not verified myself) that this issue occurs on 2.8 GHz Quad-Core Intel Xeon Mac Pros and 2.16 GHz Intel Core 2 Duo iMacs.  Detailed description of the issue:Random function creates exact duplicate 20-digit numbers within a few hundred attempts.  Exact steps to reproduce the issue:1. Create a database, one text field2. Create script to generate random numbers, beep if duplicates found----------Loop New Record/Request Set Field [ RandomGen::textField; Random ] Set Variable [ $var; Value:RandomGen::textField ] Enter Find Mode [  ] Set Field [ RandomGen::textField; "=" & $var ] Perform Find [  ] If [ Get ( FoundCount ) ≠ 1 ] Beep Pause/Resume Script [ Duration (seconds): 3 ] End If End Loop ----------3. Run for a few cycles to generate 1,000 random numbers4. Quit FileMaker, relaunch, reopen the database5. Start script again without clearing out records from the first runExpected Result:The database should find its first duplicate 20-digit number after a few decades of running this script. Actual Result:Nearly every number already exists. Any workarounds that you have found:Calculate in some digits from current timestamp to get more mixed-up numbers