How to produce a random number sequence that doesn't produce more than X consecutive elements
问题 Ok, I really don't know how to frame the question properly because I barely have any idea how to describe what I want in one sentence and I apologize. Let me get straight to the point and you can just skip the rest cause I just want to show that I've tried something and not coming here to ask a question on a whim. I need an algorithm that produces 6 random numbers where it may not produce more than 2 consecutive numbers in that sequence. example: 3 3 4 4 2 1 ^FINE. example: 3 3 3 4 4 2 ^ NO!