js math random get +1 or -1 code example
Example 1: math random from minus 1
var plusOrMinus = Math.random() < 0.5 ? -1 : 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