Generate a Baseball Pitch String Goal
Write a program or function that takes a positive integer n and randomly generate a legal series of pitches (henceforth called a Pitch string) of length n.
Input
A non-zero, positive integer n &lt;= 100
Output
Return a random string, or list of characters, that represent a possible, valid pitch string of length n. The characters used will be:

B - Ball. If you accumulate 4 of these, the batter is walked and finished batting.
S - Strike. If you accumulate 3 of these, the batter is out and finished batting.
F - Foul. Will also increase the Strike count but cannot get the batter out. I.e., you cannot have a Foul be the last pitch in a valid string. Any fouls past two strikes/fouls will not increase the Strike count (the batter already has 2 strikes at that point and a 3rd would get him out).
H - Hit. The batter has hit a ball into play and is finished batting.

(This is simplified slightly but don't you worry about that)
Valid pitch strings are those that end in a strike-out, a walk, or a hit.
I.e., an invalid pitch string has either

additional pitches after the 4th Ball, 3rd Strike, or Hit
terminated before generating a 4th ball, 3rd strike, or Hit.

Rules

Your program must be able to produce all possible results for a given input.
Your program does not have to be uniformly random but still must follow the previous rule.
This is code-golf.

Examples
Input =&gt; Possible Outputs
1 =&gt; [H] #Can only end with a hit
2 =&gt; [S,H], [B,H], [F,H] #Can only end with a hit
3 =&gt; [S,S,S], [F,F,S], [B,B,H], ... #Can now strike-out, otherwise must end with a hit
4 =&gt; [B,B,B,B], [S,B,S,S], [B,F,S,S], [B,B,B,H], ... #Can now be walked, struck-out, or get a hit
6 =&gt; [S,B,S,B,B,H], [F,F,F,F,F,S], ... #Can now have a full-count (3 balls, 2 strikes) before finishing 

Input =&gt; Invalid Outputs
1 =&gt; [S], [B]    #Not enough for a strike-out/walk
2 =&gt; [S,S]       #Not enough for a strike-out/walk
2 =&gt; [H,H]       #Batter has already scored a hit
3 =&gt; [S,S,F]     #Fouls will not cause a strike-out
4 =&gt; [S,S,S,H]   #Batter has already struck out
5 =&gt; [B,B,B,B,B] #Batter has already walked
Python 2, 128 bytes



from random import*
def g(n):
 x=i=S=0;r=''
 while(S&gt;2)+x&lt;3&gt;=i-S:x=randint(0,3);r+='BFSH'[x];S+=x&gt;0;i+=1
 return(i==n)*r or g(n)


Try it online!

Randomly generate the pitch string until the batter is done, output it if it turns out the right length, and otherwise try again from scratch.



Python 2, 136 bytes



from random import*
def g(n):
 B=H=F=S=0;r=''
 while(F+S&lt;3or'S'&gt;x)&gt;B/4+H:x=choice('BHFS');r+=x;exec x+"+=1"
 return(len(r)==n)*r or g(n)


Try it online!