Randomly generating -1 and +1
Hi all, just want to share a little snippet that may be useful.
To randomly generate either a -1 or +1, use random(0,1)*2-1
As an example, this could be used to randomly change an objects linear motion between going left or right, or changing the orbital travel direction between anti-clockwise and clockwise.
To randomly generate either a -1 or +1, use random(0,1)*2-1
As an example, this could be used to randomly change an objects linear motion between going left or right, or changing the orbital travel direction between anti-clockwise and clockwise.
Comments