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.

35 random non-repeating records

Featured Replies

I have a simple table of name that I would like to create a random draw of 35 non-repetative names, where would I start with this?

Start by adding a number field Position. Use replace to fill it will a serial number. In a script make a loop that starts with the first position, gets a random number between 1 and the number of records. Exchange position numbers between these records. Go to position 2 and repeat the above. Continue until you have exchanged the last position. Sort by position. Use the first 35.

You can repeat the process several times to get more changes to the order.

Create a calculation field, cRandom = Random (result Number, unstored).

Show all records.

Sort by cRandom.

Go to Record 36.

Omit Multiple Records [ Get ( FoundCount ) - 35 ].

Rivet, Do you mean 35 random, unique names? Do the names have to be real names, such as Bob, Peter, etc. or can they be Glbb, Pkz, etc.?

  • Author

they need to be names pulled from a table of names.

Thinking about it now, I am going to try a script that will loop, do a find on a number in the 'found count' if that record has been tagged, skip, else tag.

Take a look at the sample file that does what I had suggested earlier. It has 2 scripts one which will set the order number in sequence, the other which will randomize it. You can repeat the second several times to get more mixing. Sort of like shuffling a deck of cards.

Ralph, I can't read your attachment cos it's .sit but rivet is after a card hand, not a shuffled deck.

Rivet, If your table of names is in a table separate from your selected subset, then

1. Number your names (auto serial will do) Say N names.

2. Select a random number between 1 and N

3. Copy that name and serial into your table

4. (3.5) Define a self-join on serial

5. If Count(SelfJoin::serial) > 1 delete it and get another one.

You need a copy of Stuffit expander for Windows, it used to be free, I haven't checked recently. Works with all sorts of compressions. You shuffle the cards before you deal the hand. I can send you a .zip if you are interested.

  • Author

here is my sample

draw.fp7.zip

Ralph,

Thanks. I'll check out the Windoze version. (No need to waste your time on my abysmal ignorance.)

I just love the way so many of these posts descend into arguments/discussions/duels/.. about what the original poster was looking for. The really beaut thing is that rarely does the OP join in!

This time he has and I'm going to have a look when I sober up in a minute or two.

(It's real time here - about 00.07) Blackstuff.gif

Rivet,

Sorry to be so long. A network break and a paying job intervened.

I like your solution. Neat. Why did you add 1 to the FoundCount? You do not need to cater for the extremes of Random (0 and 1). Go to Record [Value] takes you to record 1 or the last record, if the Value is outside the valid range.

You do realise that your set is not, mathematically speaking, truly random?

  • Author

thanks I will fix the 1.

and what do you mean not entirely random? You are scaring me.

Rivet,

I thought I'd posted this already. Must be gremlins.

Like your script! Why are you adding 1 to your random number? 'Go To Record[by number]' takes you to the first or last record if the number is out of range.

The way radom numbers are generated is not truly random. Each number in the series is dependent on a seed number. The seed may be generated from the date, the time, the computer's id, and even the preceeding random number. I don't think you have anything to worry about.

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.