Saatmaris Posted June 22, 2015 Share Posted June 22, 2015 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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 22, 2015 Share Posted June 22, 2015 (edited) 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 June 22, 2015 by bsmither 1 Quote Link to comment Share on other sites More sharing options...
requinix Posted June 22, 2015 Share Posted June 22, 2015 When calculating the 25, remember to round up: ceil($number_of_respondents / $number_of_scenarios). Quote Link to comment Share on other sites More sharing options...
Saatmaris Posted June 23, 2015 Author Share Posted June 23, 2015 Thanks guys. Really appreciate. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.