# Picking the winner of this $100 Amazon gift cert from survey responders

**URL:** <https://forum.beeminder.com/t/picking-the-winner-of-this-100-amazon-gift-cert-from-survey-responders/2780>\
**Category:** Akrasia\
**Created:** [December 9, 2016, 7:16am UTC](https://forum.beeminder.com/t/picking-the-winner-of-this-100-amazon-gift-cert-from-survey-responders/2780 "2016-12-09T07:16:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreev](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/dreev/32/4311_2.png) [@dreev](https://forum.beeminder.com/u/dreev)\
**Post date:** [December 9, 2016, 7:16am UTC](https://forum.beeminder.com/t/picking-the-winner-of-this-100-amazon-gift-cert-from-survey-responders/2780/1 "2016-12-09T07:16:02Z")

</div>

Remember this survey? [https://link.webropolsurveys.com/S/94D53F822AB0FDD9](https://link.webropolsurveys.com/S/94D53F822AB0FDD9)  
It’s all about how you use Beeminder and was made by researchers in Finland who, btw, would still be grateful if more of you took it. But you’ll have to do so out of the goodness of your hearts now because we’re picking the winner of our bribe from the list of 30 people who filled it out and included an email address.

The bribe was a $100 Amazon gift certificate. So we need to randomly pick one of these folks. Actually I checked [how I announced this](https://twitter.com/bmndr/status/796084915376951297) and I never promised to pick randomly. So I started thinking about ways we could pick based on merit (forum contributions?) or who pays us the most money. Then a little angel popped up on my shoulder who was not happy with that line of reasoning at all. I’ll spare you all his moralizing but, here’s the funny part: I acquiesced and started typing `RandomInteger[{1,30}]` in Mathematica but then a _meta_-angel popped up on the first angel’s shoulder and pointed out that if the first angel was needed to convince me not to pick my BFF out of the list then why should anyone trust me to draw randomly?

Long story short (alright, short story needlessly drawn out by anthropomorphizing every intermediate thought I had along the way), I decided it would be interesting or fun or fair or whatever rationalization for my nerdery is handy, to not only randomize but to prove I was randomizing. How to do that? I got the idea from the [xkcd about geohashing](http://xkcd.net/426/). I just commit to the ordering of people (below) and then use tomorrow’s Dow opening price to construct a random number from 1 to 30 like so:

```
Mod[Hash["19614.81", "MD5"], 30] + 1

```

That “19614.81” was today’s (2016-12-08) Dow opening so I’ll just replace that with tomorrow’s and we’ll have our winner! (Today that would’ve chosen #4, Doug.) [1] After all that build-up I presume someone will double-check me to make sure I don’t cheat.

PS: Oh hey, a little devil appeared on my other shoulder and suggests that the winner should have to read this and correctly determine that they are in fact the winner, with the procedure repeating every business day until someone succeeds. (With disqualification for wrong claims, of course.) Oh, whoops, the angel just slapped him and said “no techie favoritism!”. Never mind that then.

Here’s the list of candidates:

1. Adam
2. Scott
3. Dan
4. Doug
5. Jay
6. Nevan
7. Jessie
8. Robin
9. Will
10. Michele
11. Stefan
12. Josh H
13. Josh P
14. Clarissa
15. Lawrence
16. Vladimir
17. Neil
18. Anna
19. Bryan
20. Tom
21. Allison
22. Jason
23. Nick
24. Adrian
25. Noah
26. Israel
27. Melissa
28. Louis
29. David
30. Jen

Good luck!

* * *

[1] WolframAlpha will compute this if you ask, for example, “md5 hash of 19614.81” and then click the integer form to get a new query with that number and append “mod 30” and then add 1. I don’t know how to put parens around things in WolframAlpha to get it to nest different computations.

---

<div class="post-metadata">

**Author:** ![dreev](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/dreev/32/4311_2.png) [@dreev](https://forum.beeminder.com/u/dreev)\
**Post date:** [December 9, 2016, 6:13pm UTC](https://forum.beeminder.com/t/picking-the-winner-of-this-100-amazon-gift-cert-from-survey-responders/2780/2 "2016-12-09T18:13:33Z")

</div>

Drum roll… The Dow opening today (2016-12-09) was 19684.26 so

```
Mod[Hash["19684.26", "MD5"], 30] + 1

```

returns 27 so Melissa is the winner! 🎉 🎊 ❗

(Assuming she replies to my email informing her. I better be creative about the subject line. “You’ve just won a $100 Amazon gift certificate” is the kind of thing that would go from my eyeballs to my fingers hitting the spam button without it ever entering my conscious brain.)

---

<div class="post-metadata">

**Author:** ![pjpants](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/pjpants/32/1483_2.png) [@pjpants](https://forum.beeminder.com/u/pjpants)\
**Post date:** [December 9, 2016, 8:14pm UTC](https://forum.beeminder.com/t/picking-the-winner-of-this-100-amazon-gift-cert-from-survey-responders/2780/3 "2016-12-09T20:14:58Z")

</div>

I won! I won! Thank you!

And for all who wondered, the subject line was suitably enticing and creative. Although it’s funny… I spent a split second cursing my priority inbox filter for putting a regular old beeminder email in my priority inbox. So it made the surprise even sweeter!

---

<div class="post-metadata">

**Author:** ![ciphergoth](https://avatars.discourse-cdn.com/v4/letter/c/97f17d/32.png) [@ciphergoth](https://forum.beeminder.com/u/ciphergoth)\
**Post date:** [December 9, 2016, 11:08pm UTC](https://forum.beeminder.com/t/picking-the-winner-of-this-100-amazon-gift-cert-from-survey-responders/2780/4 "2016-12-09T23:08:08Z")

</div>

I would have:

- chosen a random 256-bit value (expressed as hex, to make life easier)
- revealed the hash of the value
- the next day, concatenated that value with the output of the NIST randomness beacon (and, sure, the Dow opening, why not), hashed all that together to choose the winner, and revealed the value and the winner.

This scheme is secure even if someone can manipulate the Dow opening value to choose the winner. There are more sophisticated schemes where multiple parties precommit to secrets and the winner is random so long as even one party is not colluding with the others.

---

<div class="post-metadata">

**Author:** ![dreev](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/dreev/32/4311_2.png) [@dreev](https://forum.beeminder.com/u/dreev)\
**Post date:** [December 13, 2016, 9:45pm UTC](https://forum.beeminder.com/t/picking-the-winner-of-this-100-amazon-gift-cert-from-survey-responders/2780/5 "2016-12-13T21:45:59Z")

</div>

I love that there’s an elegant way to make this robust to any amount of manipulation short of everyone colluding!

I’m ok with living on the edge though and presuming a hash of the Dow can be universally trusted as a random number. I hadn’t known about the NIST randomness beacon, which is super cool, but I actually feel like the Dow hash is more trustworthy. Just in the sense that, if you also hadn’t heard of the NIST randomness beacon then you’d have to take the time to make sure I didn’t fabricate that whole site. The Dow opening you can just google. And running it through a hash makes it perfectly random despite the high day-to-day correlation. Also I bet it would be cheaper for a determined adversary to hack what NIST reports than to manipulate the Dow. It would take a lot of capital to nudge the Dow by a penny and much more to nudge it adaptively as it bounces around for its own reasons, getting it to land where you needed it to.
