The program we used to draw the raffle for the HHB 2023 Raffle Draw.
Works by taking an input in the form of:
[
{
"name": "Ticket Buyer"
"ticketCount": X
},
]
where X is the amount of tickets bought by the person.
We then create an array of names, with each name appearing the amount of times they bought tickets.
We then shuffle the array to a random order, and then for the 18 prizes:
- Ze pickle $100
- Ze pickle $75
- Ze pickle $50
- Lulu Lemon Indooroopilly Seeding Session
- Lulu Lemon Indooroopilly Seeding Session
- Lulu Lemon Queen Street
- Science of Fitness
- Iron Hides Tattoo
- All Sports Physiotherapy Kangaroo Point
- Hawthorne Coffee
- Yilay Tie
- Go-to Skin Care
- Suit Society Tailored Suit
- Voco Hotel (1 Night Stay)
- Hotel Indigo (1 Night Stay)
- Broncos Signed Footy
- Titans Signed Footy
- Freds Forge Knife Set
- City Cave
We generate another random number, which is then used to pick a name from the array. This random person is the winner of that given prize.
We then remove this number from the array, so that it cannot be picked again.
Once this is done, we print out our prizes and their winners.
Thanks for playing and supporting mens health!!
Assumes that you have a file raffle-entries.json which contains an array like above of all ticket purchases and the amount they purchased.
From root, then run (assuming you have bun installed):
bun winner-winner-chicken-dinner.ts