Does the random function support decimals?

Fafnir312Fafnir312 Member Posts: 161
edited November -1 in Working with GS (Mac)
I'm creating lightning and I have it working except that random seems to return a 0 if I use decimals for the min and max.

My change/constrain attribute behavior:
self.fadeSpeed to random(0.007, 0.07

Comments

  • ktfrightktfright Member Posts: 964
    always kind of worked for me when doing something random, but does it haveto be a decimal?
  • ipwnuipwnu Member Posts: 19
    random(7,70)/1000

    though .007 I think is too small if you are using it for a timer. I think the smallest number that is noticeable is .01.
  • Fafnir312Fafnir312 Member Posts: 161
    Hmmm... now that I think about it I could use whole numbers and multiply by 0.001.

    EDIT:
    @ipwnu: yeah, or that could work.
  • JGary321JGary321 Member Posts: 1,246
    I know I've tried with timers & if I remember correctly, if I put in any number less than .1 it changed it back to .1

    Therefore, I would imagine that .1 is the min anything can be.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    I've tried with .05 and that worked. But the test didn't have that many behaviors. The more behaviors you have the longer its going to take to finish running them all.
  • JGary321JGary321 Member Posts: 1,246
    CodeMonkey is it different on timers? I could have sword it actually changed it to .1 when I went lower than that.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    I just tried it and it took values less than .1
Sign In or Register to comment.