Algorithm to increase odds of matching when randomly selecting
- by Bryan
I am building a mobile game loosely based on dual n-back http://brainworkshop.sourceforge.net/tutorial.html
Now with the game I have 9 squares (numbered 1 through 9) and 9 letters (A through K)
In the current code, I randomly select a square (e.g. 3) and a letter (e.g. C), then repeat the random selection for the next turn. For 1-back, I test whether either, neither or both match the previous turn.
The problem with my current code is I get very few matches - I can go through many turns without having either match.
How can I increase the match frequency, or alternatively decrease the randomness so a match is more likely?
I am not looking for specific code (but pseudo-code would be fine) - just more an approach to increase match frequency.