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!
asked Aug 22 '14 at 02:27 PM in Blueprint Scripting
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.
answered Aug 22 '14 at 02:48 PM
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.
answered Aug 24 '14 at 07:25 AM
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.
answered Aug 25 '14 at 02:39 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here