random from -1 to 1 code example
Example 1: random python between 0 and 1
import random
random.random() # Gives you a number between 0 and 1
Example 2: javascript random number 1 or -1
//an equation that returns either 1 or -1
var number = ((Math.floor(Math.random() * 2) - 2) * 2) + 1