Rubik's Cube Scrambles Your task is to create a random sequence of moves, which can be used to scramble a Rubik's Cube. Such a scramble is made up of exactly 25 moves. Each move consist of of the letters UDRLFB optionally followed by one of the suffixes '2.
This notation is called the Singmaster notation. UDRLFB represents one of the 6 faces and the optional suffix '2 represents the turning angle. This information is in no way  necessary to solve the task. 
To assure, that the scrambles are of 'good quality', the following two rules have to apply:

Two consecutive moves must not have the same letter. This bans the consecutive moves UU, DD, RR, LL, FF and BB and all their combinations using the optional suffixes like U2U or U'U'.
These move pairs are banned, because they can easily reduced to 1 or 0 moves. U2U has the same effect as U', R'R the same effect as  .

Three consecutive moves must not be of the same letter group. The letter groups are UD, RL and FB. This rule additionally bans the consecutive moves UDU, DUD, RLR, LRL, FBF, BFB and all their combinations using the optional suffixes like U2DU, RL'R or B2FB'.
The groups sort the faces by their move axis. U and D are in the same group, because both turn around the same axis. Therefore an U move doesn't influence the pieces of the D face, and a D move doesn't influence pieces of the U face. Therefore the two moves can be exchanged, UDU has the same effect as UUD, and this can be reduced to U2D. 


Challenge
Write a script or a function, that generates one random scramble. There is no input. The script / function has to print the 25 moves without separation or separated by one space or return the correspondent string.
Your program has to be able to create every single scramble, which satisfies the rules above. Of course assuming, that the random number generator is true random, and not pseudo random.
This is code-golf. The shortest code (counted in bytes) wins.
Examples outputs:
Calling the script / function 3 times should print / return something like:
R'B2R2F2R2FB'R2DR2ULFB2RB'U2B'FL'BR'U'RB'
U'DBR'B2U'B'U'RUF'B'RDR2U'B'LR'B'F2D2UF2L'
BR2F'B'R'D'R'U2B'F2D2R'F2D'F'D2R2B'L2R'UB'R2L'D

If you separate the moves by a space each:
R2 L' F2 U2 D' R2 L2 F L' D2 U R B D' U2 L B2 L U B2 D U2 R' D2 U'
B R D2 F U2 B' R2 F2 B' U' L' R2 B U2 R' D B' F' U2 R' B' L R D2 R2
B2 R2 U D' B R D' R L2 D2 L2 R B2 F U' F2 B2 U' F U' D F R2 U2 B'

Notice, that all these outputs consists of 25 moves, but have different lengths, because of the optional suffixes. It's not allowed to print a space, when either 2 or ' are uses as suffix. You have to print L2UR2F'R'U2 or L2 U R2 F' R' U2. L2U R2F'R'U2 is not allowed.
C,129
f(){int i,n,m,r,s,t;for(i=26;i--;i&lt;25&amp;&amp;printf(&quot;%c%c&quot;,&quot;URFDLB&quot;[s%6],&quot;'2&quot;[r%3])){for(n=m,t=1;t;t=m*n==9)m=(r=rand()%15)/3+1;s+=m;}}

The inner loop generates a value of m in the range 1..5 which when added to s and taken modulo 6, ensures that no two consecutive moves are on the same side of the cube. The old value of m is stored in n and the test m*n==9 ensures that the value m=3 is never generated twice in a row (so opposite faces cannot be picked twice in a row; note the order of faces in the string.)
The least significant part of r is used to decide which suffix (', 2 or null) to use, taking advantage of the null character at the end of &quot;'2&quot;.
The outer loop runs 26 times. The first time, U can never be picked, so printf is suppressed for the first iteration.
Ungolfed code in test program
The ungolfed code puts a space between each move for clarity (the golfed code does not, in order to save one byte.) Additionally the golfed code saves a semicolon by relocating the printf within the for bracket.
f(){
  int i,n,m,r,s,t;
  for(i=26;i--;){
    for(n=m,t=1;t;t=m*n==9)m=(r=rand()%15)/3+1;
    s+=m;
    i&lt;25&amp;&amp;printf(&quot;%c%c &quot;,&quot;URFDLB&quot;[s%6],&quot;'2&quot;[r%3]);
  }
}

main(){
  int j;
  srand(time(0));
  for(j=0;j&lt;5;j++)f(), puts(&quot;&quot;);
}

Typical output
U' B D2 B' R' L F' D2 B D2 B2 R' B2 U D2 F' R U R' L B' L R2 B2 F'
U B U B F L2 D2 B' U' L B L R' D B U' D R D' B' F2 D' B D R
L D F2 B2 R' U F B' D2 L U R' L' U2 F' R F D U2 B L' B' U L2 F'
R2 B' F2 R2 L2 F' U2 L U' B' F R' D' F2 D F' L2 U2 R' D' B2 D F R2 L'
U2 F2 B2 D' F D F R L2 U' B D2 L' R D R F2 R' F2 U2 D R' D2 L F2