Create a program that generates a drum fill. Your program will output a pattern of L
(left hand hits), 'R' (right hand hits), and K
for kick drum hits.
Rules
- The pattern must never have more than 2 of the same hits consecutively.
- The pattern must be loopable, so it mustn't have more than 2 of the same hits when it loops.
- Your program accepts 1 argument which is the length of the pattern. You can assume this will always be an integer > 1.
- Program output must be random each time it's ran. It should be properly random each time, so that every combination is possible, so for an input of 2 for example: LR, LK, RL, RK, KL, KR all have a chance of being generated.
- IO can be used with any convenient method.
- Standard loopholes are forbidden.
- This is code-golf, so smallest program wins!
Example valid output:
RLRRKKLL
LRLLKKLR
LKKRLRKLRRKL
LRLR
Example invalid output:
LRLL // 3 characters when looped
LRLRRRLLR // 3 characters in a row
RRLRLLRR // 4 characters when looped