show me the codez
There are basically two parts to our bucketing:
- Generating a random number
- Hashing the random number into a discrete range – i.e., 0-99 inclusive
It’s important to note that we did not build all of the bucketing code from scratch. Instead we opportunistically leveraged existing code. If we were to build this from scratch, this is probably not how we would do it. By extension, it’s almost certainly not exactly how you should do it.
If we had been building from scratch, the code probably would have looked more like this: