FORUMS: list search recent posts

About random&round&clamp

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
adam chen
About random&round&clamp
on Jan 17, 2012 at 7:06:52 am

r = Math.round(random(-1,1))
v = clamp(r,0,1)

Why Mr.Frank said that the result has 1/3 chance get 1?
think about that:
-1 to-0.5 --> -1
-0.5 to 0.5 ---> 0
0.5 to1 --> 1
Why not 1/4?


Return to posts index

Dan Ebberts
Re: About random&round&clamp
on Jan 17, 2012 at 2:12:31 pm

I think you're correct. Something like this should work:

random(3) < 2 ? 0 : 1;


Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]