What I am trying to do is to randomly place these 50 people into 8 different rooms (with a max of 7 in each room). The trick is to try not having the same letter in the same room. Would any of you be able to help me with this? I have attached a picture of what I am trying to attain.
I have been wrapping my brain around this idea all day, and cannot find a way to begin. I know this is possible, but I have no idea. I look forward to hearing your responses.
There's probably a more elegant way, but here's what I came up with. (I'll leave it to you to output the $assignments array in the desired HTML format or whatever you want.)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Thank you for the script above - it is working magically. How would I be able to then set a limiter, saying that yes, no more than 7 people in a room, but no less than 5?
That sounds a bit messier. Maybe after getting to that point, you'd then have to come up with a routine to look for sub-arrays with less than 5 elements, and if you find one, randomly choose one of the sub-arrays with more than 5 elements and "move" one of its members to the underpopulated array?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks