Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: derkoi on August 21, 2013, 05:01:12 AM

Title: Random Range from float value?
Post by: derkoi on August 21, 2013, 05:01:12 AM
Just wondering if anyone has made or can make an action you can enter a float value and a value above and below it and it picks a value in that range at random?

So if the input float value was 1 and my max and minimum range were 1 then I'd get a random result between 0 and 2. If my input float was 5 and the ranges were 1 min and 1 max I'd get a random value between 4 and 6.

Hope that makes sense.  :)
Title: Re: Random Range from float value?
Post by: derkoi on August 22, 2013, 02:38:47 PM
Nevermind I've made one myself.  ;D
Title: Re: Random Range from float value?
Post by: jeanfabre on August 24, 2013, 04:22:49 AM
Hi,

 How did you managed to do it?

bye,

Jean
Title: Re: Random Range from float value?
Post by: derkoi on August 24, 2013, 04:31:23 AM
Basically, it takes the input value and subtracts the users lowest value to use as the low range limit and adds the users highest value for the users high range limit:

user inputs
Input float = 2
min range = 1
max range =1

min range subtracted from input = 1
max range added to input = 3

random range between min & max (between 1 & 3)

Thats it.

I've also made another action the same as above but only processes when the input value changes. I'll add them to the custom actions forum.  :)
Title: Re: Random Range from float value?
Post by: jeanfabre on August 24, 2013, 07:40:34 AM
Hi,

 Thanks!

 Jean