Random chars

Dear Arduino community!
I have a programming question for you and I will be very thankful if you could help me.

The situation is as follows:
I'm trying to build a Rubik's cube timer (with a scramble function) for a long time. The schematics is nothing special - 2 tactile sensors, a 16x2 LCD display, a power supply and 2 LEDs. But I'm struggling with the code because I'm not much in programming.
Can you help me with a procedure of a program with which I will be able to generate a random scramble from chars? The possible chars are: R, R', R2; L, L', L2, etc. and the sequence consists of 15 chars. The situation is complicated because the code must have a check for the previous symbol. For example: R L R' L' is a good way; R R' L L' is a bad way; R2 R2 is a bad way, too. :slight_smile: I'm thinking about the way..may be it will be better if the chars are translated into numbers, do something with them and after that, translate them again into chars to write them on the LCD.
Hope you understand me. I will be very thankful for an advice or a piece of code. :slight_smile: Thank you in advance.
P.S. I will make a block-diagram of the above procedure these days.

Best regards,

If and else if statements that if the last "random" pick is R or R' pick a new random from L, L', U, U' etc....