[RM2K3] SET RANDOM BETWEEN V.A & V.B INSTEAD OF X&Y?
Posts
Pages:
1
Hello, everyone. Ultimately, I know there are ways around this (long and tedious ways), so it's definitely far from the end of the world if this can't be done, but is there a patch or a plugin or something that will allow you to set a random variable value between two numbers that are referenced by variables instead of numbers that must be defined?
Like, if var0001 equals 4 and var0002 equals 19, then do something like "set var0003: Random between var0001 to var0002", producing a random number between 4-9? It would be an extremely useful feature.
Or to point to those values too. So that I can use variables 0001 and 0002 to point to variables 0004 and 0019. Let's say v0004 equals 7 and v0019 equals 12, then "set v0003: Random between ReferenceFrom0001 to ReferenceFrom0002", which would result in a random number between 7 and 12.
Like, if var0001 equals 4 and var0002 equals 19, then do something like "set var0003: Random between var0001 to var0002", producing a random number between 4-9? It would be an extremely useful feature.
Or to point to those values too. So that I can use variables 0001 and 0002 to point to variables 0004 and 0019. Let's say v0004 equals 7 and v0019 equals 12, then "set v0003: Random between ReferenceFrom0001 to ReferenceFrom0002", which would result in a random number between 7 and 12.
A simple workaround would be to have, say, a random 1~100, then check if the result is above v1 and below v2 using Conditions. If not, rinse and repeat.
Another, probably faster, way, would be using multiplication and division.
You could - assuming your max. value doesn't go beyond 1000 - do something like Random 0-999, then multiply by your max. value, then divide by 1000.
(This trick will only work with values less than ~3160 because you will hit the 9999999 limit otherwise.)
You could - assuming your max. value doesn't go beyond 1000 - do something like Random 0-999, then multiply by your max. value, then divide by 1000.
(This trick will only work with values less than ~3160 because you will hit the 9999999 limit otherwise.)
Oh, wow. I don't think I ever would have thought of that in a million years. o.O
What if my minimum value is dynamic too though? Like, what if my minimum value isn't always going to be zero? Maybe I want to do random number between x and y values which both fluctuate often enough as to be unpredictable? This is great if I'm either starting from 0, or if the minimum value is fixed, so I'll know what it will always be. Though there are times where this isn't always the case.
EDIT: Nevermind. Now that I think about it, the method described in Avee's post actually covers that rather nicely (By which I mean that I can just have it do another scan if it results in a value below the minimum).
What if my minimum value is dynamic too though? Like, what if my minimum value isn't always going to be zero? Maybe I want to do random number between x and y values which both fluctuate often enough as to be unpredictable? This is great if I'm either starting from 0, or if the minimum value is fixed, so I'll know what it will always be. Though there are times where this isn't always the case.
EDIT: Nevermind. Now that I think about it, the method described in Avee's post actually covers that rather nicely (By which I mean that I can just have it do another scan if it results in a value below the minimum).
Pages:
1














