What I do for this is preload the conditions into an array and then present the desired row from that in the main trials loop.
My Independent Randomisation demo does this.
but I now use code to preload as per my Trial Switching demo