NYCPHP Meetup

NYPHP.org

[nycphp-talk] Question about random selection

Anthony Papillion anthony at adcl.biz
Mon Dec 10 03:24:24 EST 2007


Hello Everyone,

I have a problem that I'm hoping someone here can help me solve. It's 
plagued me for a while now and, to be honest, I'm not terribly sure 
there actually is a workable solution. Here's the deal.

I have a 'secret santa' type application that I designed for a Yahoo 
Group my wife owns.  The way it works is that people go to the site, 
enter their email address and are randomly matched with some other 
person. The two filtering criteria for the match are 1) the persons 
match can't be taken )as indicated in an 'isTaken' field) and 2) the 
persons match can't be themselves.

The systems works very well unless there are an odd number of people on 
the list. Then, one person is left out. We've just run into this problem 
a few minutes ago. There are 7 people on the list and everyone is owned 
by someone else except one person.

Any idea how I can make this workable on an odd numbered list?
Your help is really appreciated.

Thanks,
Anthony Papillion



More information about the talk mailing list