Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Featured Replies

  • Newbies

I've been using FileMaker for the past 3 years to generate a random number for lottery applicants to our charter school. It has worked really well for that purpose.

Problem I keep having is that as our application pool grows bigger, so does my occurance of repeating "random numbers". I can't figure out how to make the random numbers discrete, so that it doesn't look as though we've rigged the results.

Calculation I'm using for the number is Int(Random*10) & Int(Random*10) & Int(Random*10) Is there something I can add to that to make the resulting 3 digit number unable to repeat, or is there something else I need to define elsewhere?

Thanks......

Another way to approach this would be to have a file/table with 999 (1000?) records numbered sequentially, with a calc to format the serial number with padded 0's, and a field to flag the used numbers. Then have a script Find records that haven't been marked, and use the Random function to choose a random record in the found set.

I think you can do without the table (unless you need it for tracking the ticket sales, or something), and use simply:

Int ( random * n ) + 1

where n is the number of tickets (starting from ticket #1). This can be padded with leading zeros, if so desired.

Is there something I can add to that to make the resulting 3 digit number unable to repeat

Yes - but THAT would be rigging the results. Random is random, and random numbers do repeat - at random...

  • Author
  • Newbies

I don't think I explained well. This is the equivalent of pulling children's names out of a hat for a limited number of spots in the school. We assign everyone a number (randomly) and then order the numbers to determine who gets in, and the order of the subsequent waitlist. If I have two kids who both draw 101, for example, I have a problem. The last two years it's happened, but the numbers were high so the kids were down the waitlist.

We do this in public and invite the public (nobody has ever showed up), but basically we create the database while people are watching. The paper applications are ordered alphabetically, and then as I create a new record for a new name, the random "lottery number" is created in the field. Then we sort by grade and lottery number, print and certify the results.

It seems that what you are suggesting is to have a set of "prenumbered" records available that I enter the data in (and that come up in random order), rather than creating a new record for each name as I go along. Have I got that right?

Edited by Guest

There are many ways to do this. For example, you could just enter everyone into a list (in any order), then draw the winner by script (the script goes to a random record, sets a field to "winner"). Then omit the winning record, and repeat the process to draw the first runner up, and so on. Using Status(CurrentFoundCount) as n in the formula above will assure there will be a 'winner' in each round.

Alternatively, you could continue with the current method, but check (again, by a script) if the random number has been already assigned, for example (untested);)

Loop

Set Field [ LotNumber ; Random ]

Exit Loop If [ not SameNumber::LotNumber]

End Loop

where SameNumber is a self-join based on LotNumber.

  • Author
  • Newbies

Thanks!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.