I've been asked to build a prize giveaway web page with the following competition parameters:
- A user can only enter the competition once per day
- It's an instant win competition, the user will know if they have won or not when they enter
- We want to give away on average 1 prize per hour
My first thought was at the start of each hour, to select a random second within that hour for the prize to be given away. The first user who enters after that second is the winner. If a hour goes past where no one actually enters, a new time will be chosen somewhere in the next 12 hours to give away that hours prize (this is to stop the late night prizes all being given away in the morning).
I can't tell if this will be random enough for a fair competition. Also, there is a slight security risk in that if someone were to view the upcoming prize draw database record, they could enter at the right time and win the prize.
Is there a better way to achieve this?