Mastering random
This one is for the uber nerds and the business people alike.
Last week, when I was whipping up one of the fastest MVPs of my life, I had an interesting problem to solve.
People who play Bingo need randomized cards; otherwise, everyone will get Bingo at the same time.
Great, so all we have to do is show completely randomized cards to everyone who shows up at the site, right?
Put on your business hat for a second. We give away 5 random cards for every game, right?
If each person who signed up for cards got completely random cards each time, you could just keep feeding it emails until you had as many cards as you had guests without paying a dime.
The solution: Give each person the same 5 unique cards each week as their freebie.
Now, put back on your engineering hat and ponder how you do that. Shoot me a message with your solution before reading further.
We could store the first 5 in S3 or Redis each week, but I wanted to streamline this as much as possible to have as few moving pieces as possible, so I went a different direction.
What I did was to use seeds. People can generate up to 250 cards (a self-imposed limitation for now). I gave each card a number: 1,2,3, etc. We then use that card as a seed for a simple randomizer. That way, we get the exact same results every time you pass in that seed.
So, if I only give away cards 1-5 each week, the customers will get the same 5 cards no matter how many emails they sign up for. That means cards 6-250 are only available if you pay.
Now there are many ways to solve any engineering problem, or business problem for that matter.
I would be curious, from a business standpoint, what you would have done differently (I am dying to figure out a subscription model).
Additionally, for you engineers out there: How would you have solved the random solution?