Controlling the probability
Hi Guys,
I'm working on a new patch, where the centre is a random generator.
I generates random numbers between 0 and 10.
Is it possible somehow to control the probability of the numbers? I mean, with a multislider maybe...you could set, for example, that the probability of that the next number will 0 is, let's say 30%, but 50% that it is gonna be 7.
look at [Itable] and Tutorial 17 ( Create probability distributions)
This might be of some help...
Thanks guys, almost there.
Now, is it possible to avoid repetition somehow?
I mean, like with [urn].
Some progress here, thanks to the RTC toolbox :
The problem is that the IF causes stack overflow if there is only 1 number :S
..
Stack overflow immediately :(
stack overflow is when all prob. = 0 or one only one prob is higher the others = 0,
Oh, yes, I see, yeah, in that way it works!!!
But...
Still not there. Maybe it's because of my english...
So, an example.
If probs for 0 and 1 are 100% (the rest 0), it should switch between 0 and 1.
...
Yap, thats right, in example two. But if the prob for 5 and 2 are both 100% it should generate 5-2-5-2-5-2-5-2-5, not?
if the prob for 2 and 5 are both 100% that makes a total of 200%.
not sure what others recommended above, but i would generate random numbers between 1-100000, then set the probability per number by [split 33.55 57.01], then do [/ 10000.]
There are two rules in play here:
Pick a random number with a weight
Avoid choosing the same number consecutively.
Picking a random number and then testing if it has been already used (and then picking a random number and then testing if it has been already used...) can easily lead to a stack overflow.
If, on the other hand, you temporarily zero out the weight for the last chosen value, you can't pick it to begin with. (You'd need to restore it afterwards of course!)