4 ms·
By the time you are tracking misses on each class of event and adjusting the probabilities, you might as well just use random permutations of the desired distri
by richard_todd 7y ago
By the time you are tracking misses on each class of event and adjusting the probabilities, you might as well just use random permutations of the desired distribution of outcomes. Like if the sword is supposed to hit 90%, just run through a 10-bit sequence with 9 ones and a zero, and shuffle it after every 10 attempts.
- b0blee 7y agoThat sounds a lot easier to me.
- deleted 7y ago[deleted]
- 1wd 7y agoFamously Tetris typically uses this "grab bag randomizer" (or various other controlled forms of randomness). I was surprised Tetris was not mentioned at all in the article. https://tetris.fandom.com/wiki/Random_Generator https://tetris.fandom.com/wiki/Random_Generator https://katta.mere.st/different-tetris-algorithms/ https://katta.mere.st/different-tetris-algorithms/
- XCSme 7y agoAre you talking about randomly shuffling the bits or getting a new permutation? Any suggestions on how to quickly randomly shuffle the bits of a number?
- richard_todd 7y agoRandomly shuffling the bits _is_ a new permutation (of those bits). There may be a faster way to shuffle the bits of whole bytes/words on some architectures, but for the general case I suspect a normal shuffling algorithm (like Fisher-Yates) and shifts+and+xor swapping is best.
- XCSme 7y agoOh, sorry for not making it clear, when I meant permutation I was referring to the the immediately next permutation. I guess after current set is over you could also take the Xth permutation of the current state, where X is a random integer. (so you randomly skip some permutations to not make it predictable).
- richard_todd 7y agoYeah jumping ahead by X permutations would be good as well.