Don’t use your existing function – just call Math.random(). If < 0.5 then -1, else 1:
var plusOrMinus = Math.random() < 0.5 ? -1 : 1;
Don’t use your existing function – just call Math.random(). If < 0.5 then -1, else 1:
var plusOrMinus = Math.random() < 0.5 ? -1 : 1;