35 random non-repeating records

This topic is 6603 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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?

Share on other sites

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.

Share on other sites

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 ].

Share on other sites

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.?

Share on other sites

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.

Share on other sites

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.

Share on other sites

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.

Share on other sites

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.

Share on other sites

here is my sample

draw.fp7.zip

Share on other sites

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)

Share on other sites

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?

Share on other sites

thanks I will fix the 1.

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

Share on other sites

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.

Share on other sites

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.

Share on other sites

This topic is 6603 days old. Please don't post here. Open a new topic instead.

Create an account

Register a new account