I don't see any good way to do that. The problem is that those things are interdependent and heavily constraining: Only a subset of all possible sequences consisting of consonants and vowels will satisfy the criterion "there should be 25% vowel nontargets, 25% vowel targets, 25% consonant targets, 25% consonant nontargets".
To illustrate, suppose your sequence starts like this (v=vowel; c=consonant; 2-back):
trial: 1 - 2 - 3 - ...
cat: v - v - ? - ...
Clearly, the 3rd trial can either be (1) vowel-target or (2) consonant-nontarget. It could not possibly be vowel-nontarget or consonant-target, so you're already constrained in your "random" selection at this point. Those constraints perpetuate as you move on. Suppose the 3rd trial is a vowel (and hence) target-trial.
trial: 1 - 2 - 3 - 4 - ...
cat: v - v - v - ? - ...
The 4th trial, then, can again only be either a (1) vowel-target or (2) consonant-nontarget, but can't possibly be a vowel-nontarget or consonant-target.
You'd have to come up with a (deterministic) algorithm that reliably generates sequences that satisfy your constraints; I don't see that it can be done with simple random sampling conducted on-the-fly / at runtime.
If you can't come up with a suitable algorithm, you can alternatively construct a couple of such sequences (say 3 or 5) manually, chose one such sequence at random and then simply use sequential item selection.
You can find some general thoughts and remarks re. constrained random sampling here:
https://www.millisecond.com/forums/Topic6419.aspxFor an example of constrained sequence generation, see the AAT's sequence generation code:
https://www.millisecond.com/download/library/AAT/Note though that the approach in the AAT has certain limits: In essence, it attempts to construct a conforming sequence one step at a time; if it hits a constraint violation, the entire sequence generation is restarted from scratch. The consequence is that the algorithm can take a long time to converge on a solution if too many constraints are imposed or even might not converge at all.
Hope this helps.