Drum fill generator
Jelly, 15 bytes
“LRK”ṗ;`E3Ƥ$ÐṂX
A monadic Link accepting an integer which yields a list of characters.
Try it online!
How?
Pretty similar to Nick Kennedy's Jelly answer...
“LRK”ṗ;`E3Ƥ$ÐṂX - Link: integer, n
“LRK” - "LRK"
ṗ - Cartesian power (all length n strings with alphabet "LRK")
ÐṂ - keep those entries which are minimal under:
$ - last two links as a monad:
;` - concatenate with itself
3Ƥ - for each infix of length 3:
E - all equal?
X - random element
05AB1E, 15 bytes
…LRKãʒDJÅγà3‹}Ω
Try it online!
…LRK # literal "LRK"
ã # strings made of `input` of those letters
ʒ } # filter:
DJ # concatenate the string with itself
Åγ # run-length encode
à # maximum (largest run length)
3‹ # less than 3?
Ω # get a random element
R, 67 bytes
n=scan();while(max(rle(c(x<-sample(c("L","R","K"),n,T),x))$l)>2)0;x
Try it online!
A full program taking an integer, n and implicitly printing the drum pattern.