randomly pair up

1. Member
Join Date
Dec 1969
Posts
79

## randomly pair up

Is there a way for me to randomly pair up values? For example I have 16 names and I want to randomly divide them into pairs. How could I go about doing this?<BR><BR>Thanks

2. Senior Member
Join Date
Dec 1969
Posts
1,944

## RE: randomly pair up

if u divide them in sets of 8, then u can get randomly generated pairs if u use two randomize statements, and concatenate both the numbers generated.<BR><BR>otherwise u will end up getting pairs iwth the same number like<BR>11 22 33

3. Member
Join Date
Dec 1969
Posts
79

## RE: randomly pair up

Thanks, I am still a bit confused though. I am not sure exactly how to use the randomize statement.

4. Junior Member
Join Date
Dec 1969
Posts
25

## RE: randomly pair up

Frank, here&#039;s one approach...<BR>1. Copy the names into a list (or an array). <BR>2. Next, using the Randomize and Rnd Functions, generate two random numbers, then compare them to see that they are not equal. <BR>3.If not, then combine the corresponding names in the list, and take them outta there. <BR>4. Regenerate the list (with the unpaired names)<BR>5. Go to Step 2<BR>This might take a while to implement depending upon the complexity of your application, but it is definitely do-able. Thanks and God Bless!<BR><BR>Wil.

5. Member
Join Date
Dec 1969
Posts
79

## RE: randomly pair up

My application is essentially 16 names but I just cannot get it to work. Help, please.

6. Junior Member
Join Date
Dec 1969
Posts
25

## RE: randomly pair up

Don&#039;t you have a manual or books that you can use to find out the syntax of the Randomize and Rnd functions? You have to put in some effort Frank...answers like this don&#039;t come easy. If we had the time, we would all email you. Go to msdn.microsoft.com, and run a search on the Visual Basic home page for more details on the Randomize and Rnd functions. Thanks.<BR><BR>Wil.

7. Member
Join Date
Dec 1969
Posts
79

## RE: randomly pair up

I understand that, I looked up the randomize function and am having trouble using it and was looking for some guidance on it.

8. Junior Member
Join Date
Dec 1969
Posts
25

## RE: randomly pair up

Ok, Here&#039;s an example on how to use the Randomize with the Rnd Function. Take it from here, Frank....<BR>&#060;%<BR> Dim MyValue, Response<BR> Randomize &#039; Initialize random-number generator.<BR> MyValue = Int((6 * Rnd) + 1) <BR> &#039;The above, generates a random # between 1 and 6.<BR> Response.Write "Random Number : " & MyValue<BR>%&#062;<BR><BR>God Bless!<BR><BR>Wil.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•