| < | March 2010 | |||||||
|---|---|---|---|---|---|---|---|---|
| S | M | T | W | T | F | S | ||
| 1 | 2 | 3 | 4 | 5 | 6 | |||
| 7 | 8 | 9 | 10 | 11 | 12 | 13 | ||
| 14 | 15 | 16 | 17 | 18 | 19 | 20 | ||
| 21 | 22 | 23 | 24 | 25 | 26 | 27 | ||
| 28 | 29 | 30 | 31 | |||||
Do you have an arrangement in your family where everyone picks the name out of a hat and the name you pick is the person you'll buy a Christmas gift for? My family does this, but it's always been a bit of a pain because not everyone involved can be at the same place at the same time in order to pull names out of a hat. Inevitably someone has a name pulled for them, which puts a damper on the whole surprise and suspense part of the fun.
To make things easier, I wrote a program that pulls a random name out of a hat for everyone and then provides a mechanism for each person to enter their password (provided to them by you, the administrator) to see who the program has chosen for them. It's smart enough not to pick a person twice. It's also smart enough to make sure that a person doesn't have someone in the same family picked for them*, which is even better than pulling names from a real hat, since when there are only two names left in the hat they could be members of the same family.
If you would like to give this script a try, you can download it from here**: http://www.opbarnes.com/downloads/xmashat.php.txt
You can also play around with a demo of the script here.
* The script will attempt to make sure it has been chosen someone from another family for each person by attempting the entire hat picking sequence up to 1000 times (the script default) before giving up and going with the best case (the "best" case is the one that had the fewest number of people whose pick was someone in the same family).
** I whipped this thing together pretty quick -- so beware!
UPDATE: This software can be used for your own secret Santa party, secret gift exchange, white elephant, etc.
posted at: 18:03 | path: /Programming/OPB/PHP | Permanent link to this entry | Add/View comments (4 existing)
Copyright ©2004-2009 O. Patrick Barnes. All rights reserved.