Jump to content

Recommended Posts

 I basically wants the following: I have 4 scenarios (each one will be assigned a number, let´s say 1, 2, 3 and 4). I want to show these scenarios randomly to 'n' respondents (each respondent will be shown only one scenario, and we have n=100 for now). May I define something in php so I can get exactly the same number of responses per scenario. I mean I need to obtain out of the 100 times, 25 times the number 1 (representing scenario #1), 25 times the number 2 (representing scenario #2), 25 times the number 3 (representing scenario #3), and 25 times number 4 (representing scenario #4), while mantaining the random assigment of numbers? Your help will be highly appreciated. Thanks in advanced.

I would start with a 100 element array, the first 25 elements describes Scene1, the second 25 describes scene2, etc.

 

Then I would shuffle() the array.

 

For each index, the scene shown will be a (somewhat) random choice from scene 1,2,3, or 4. But as one moves through the 100 element array, the total count remaining for each scene (shuffled throughout the array) decreases by one until all 25 elements for each scene has been exhausted.

 

It would be just like shuffling a deck of playing cards. Give each player (of 52 players) one card. It will be one of the four suits, and all 13 cards of each suit will get played out.

Edited by bsmither
  • Like 1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.