math random from minus 1 code example Example: math random from minus 1 var plusOrMinus = Math.random() < 0.5 ? -1 : 1;