How to make random sequence of one condition x times and another condition y times

I want to to run a trial (sequences of blueprint scripts) with two different possible conditions (one condition in 28 of the trials the other 132 trials) 160 times in a random sequence. I have no problem setting up the trial routines in blueprints and making it repeat itself 160 times randomly choosing one or the other condition each trial (branch with random bool stream as condition).

BUT what I can’t figure out is how I should go about making it so that the trial is run 160 times in a random order but with specifically 28 repitions of condition x and 132 repitions of condition y?

Hope I am clear enough and thanks for being a really, really helpful community!

Hey -

One solution would be to add a tracker to each of your conditions (x and y) to track how many times each one has triggered. Assuming you’re using a loop to trigger each of the 160 repetitions, after randomly selecting the condition you then check to see if it has run its maximum number of times allowed (as set by the tracker) and, if so, to then run the opposite condition. Hope this helps solves your problem and good luck with your project.


Hi ,

thanks for the reply. Unfortunately your suggested sollution will not work for me since it would not lead to a completely random sequence of trials. Your suggestion would makes it much more likely for condition x (28 trials) to appear early in the sequence since they have a 0.5 chance of getting choosen each time.

Kind regards

Hello again

Could you provide a bit more information to help me understand exactly what you are trying to do? It sounds like you want condition y (132 trials) to have a slightly higher chance of getting chosen with each run than condition x. Assuming this is the case you could try adding a random integer node that picks a number in a given range (from 0 to the max number of trials). If the number chosen is above a certain threshold then you can run one condition, otherwise run the other. Below is an image to show what I mean.

I will run a trial sequence with two conditions 160 times. I want 132 trials to be condition x and 28 trials be condition y. However I need the order of the trials to be completely random. So before each trial, one trial out of all the remaining trials not yet performed will be chosen randomly, and each time this happens every one of the remaining variants trials should have an equal chance of getting drawn.

Somehow I missed the random integer node. I see now how this could be done by updating the random integer max value and treshholds every draw, adjusting the odds according to number of remaining trials for each trial condition. Next time I work on my project I will try and do this.

Thank you!

Glad to be of help and good luck with your project.


Really cool