I spent the whole of two minutes determining how I would select a winner for the free ticket.

Let’s start with my objective, my objective was to give away the ticket to a random member of the mailing list. The version of the interface to our mailing list does not allow me to export the mailing list’s member list. So what I did was write a program that picks a number between 1 and the number of members in the list. Once I got the number I counted down the list until I got to that name on the list. Not fun at all.

Here is my ruby program to select a random number between 1 and the number of people on the list:

qty = ARGV[0] # input from command prompt
puts rand qty

To run it I would type at the command prompt for example: random 150

The winner was declared on the mailing list. If you want to be eligible to win the next free ticket make sure to subscribe to our mailing list.

I know you are thinking right now “I could of done it better”. So prove it. How would of you done it better?