-2*random(0,1)+1

ORBZORBZ Member Posts: 1,304
edited June 2012 in Working with GS (Mac)
-2*random(0,1)+1

It's a handy formula I use a lot for randomly selecting between -1 and 1 but not 0

Why is this useful? Because -1 * x = -x and 1 * x = x

This would let you randomly go left or right (with a lot more code obviously)

It has many other uses. I just thought I'd share it with you guys.

Comments

Sign In or Register to comment.