If I am in a coding language where I can create a random number for a given range (i.e. 0 to 50, or -30 to 751, etc.) How can I mathematically create a +1 or -1 (not a +1, 0, or -1) using only math and the random function.. no if statements.
Share
Easy.
random(0,1) * 2 - 1will do it.