Hello,
I've been struggling but largely ignoring this problem in my game for a while. I'm developing a metroidvania that involves a lot of situations where this crops up. Most of my bosses are developed using a finite state machine, so most of the time there in an event saying something along the lines of: "set state [choose("state1", "state2", "state3")]. When the state is chosen, there are some times the same one will play over and over due to random chance. I have also had issues recently when adding sound effects. I have 4 footstep audio files but when I choose randomly, it often plays the same sound multiple times in a row, which sounds off-putting.
The main question is: How can I choose randomly from a set of STRINGS and not get the same one twice in a row?
I have looked into advanced random features such as permutation tables but they mostly include numerical systems. I would assume there's a way to set strings equal to the numbers in the permutation tables or something but I am not familiar enough with advanced random to think of something.
Are there any simple solutions I'm missing? Or what is the most efficient way of implementing something to regulate this?
Any ideas would be great.
Thanks!