Proportional Random Amount behaviour
hi all,
trying to setup a random amount system for a standard parameter so that is scaled and clipped correctly so that
Eg1.: param1 0.5 random amount 0.5 the number is between 0.25 and 0.75
Eg2.: param1 1 random amount 0.5 the number is between 1 and 0.5
Eg3.: param1 0 random amount 0.5 the number is between 0 and 0.5
I'm trying to use pong in the various @mode, but probably I'm missing something pretty simple in the middle
I have worked something out, but for sure there is a more efficient way.
why pong? i would just use [clip] as last step. the rest is linear scaling and an offset.
this will save you 8 objects. :)
expr (min(max(((random(0\,10001)/10000.) - 0.5 + $f2)\,0.)\,1.))
Clipping between 0 and 1 would cause all values > 1 to be = 1 and all values < 0 to be 0 and this would affect the probability distribution.
It is not simple linear scaling since when our starting value is 0.8 for example and random amount is 0.9 we should have values between 0.1 and 1.
Where 0.1 = (0.8-(0.9/2)) - ((0.8+(0.9/2))-1)
ah, i didnt see the second patch, i thought it was by somebody else. :)
so you want the distribution to be linear, but differently for above and below the parameter value?
because with "fold" you are getting an irregular distribution.
Yes exactly with fold I have an irregular distribution. Anyway you are right, using the expr object is very convenient for keeping things short :)
indeed, pong, clip, and scale can all be done inside expr and then it all can be combined into magic supercode to impress your neighbours.
but always keep your derivation patches or you are lost when you look into it next year. :D
...post your final patch?
Thanks for the advice Roman. For now the final patch is the one I have posted in the second comment since the client is ok with that probability distribution, now I am working on other parts of the algorithm . If I will improve it I will post for sure.