Generating pseudo random codes is usually a trivial task. However, coupon codes should have two features that make them computationally complex:
- They have to be unique
- They should be hard to guess
A third optional feature would be readability. This means that the final user should not be thinking “is this 0 or O?“.
I found the problem intriguing and decided to make my personal implementation of a coupon code generator in PHP.