Implement a program or function which simulates common dice for role playing games. It should handle at least the d6 and d20, the two most common dice.
However, it should work as stereotypical gamers expect them to work, and not as real dice work.
It is an in-joke between gamers, that one can have a specially lucky die for a very very important roll, by previously throwing a lot of dice, selecting those which resulted in a "1", then throwing them again, until you get a few which rolled a "1" multiple times. You then carefully preserve them, because they rolled a 1 multiple times in sequence, so the probability to roll a 1 next time should be extremely low.
Of course, this is not how dice work in real life, because the rolls are statistically independent.
Your simulated dice have to take previous rolls into account, and work similarly to how the gambler in the gambler's fallacy expects it to work. For example, if a lot of low numbers were rolled, the probability of rolling a higher number should be increased.
However, as this is cheating, you have to hide it well. This means, a casual glance upon the program should not reveal that you cheated. This means, explicitly saving the previous results and reading them on every throw would be too suspicious. You have to hide this "property" of your dice, and bonus points if you make it plausible deniable and disguise it as an honest mistake. (for example, you make your own RNG with an "unintentional" flaw)
Voters, please take into account how well hidden this "flaw" is.
The programs should be clear, and not obfuscated. It's too easy to hide evil code in an obfuscated program.