Random number formula with negative and positive numbers


#1

Hi, I need to create a random whole number between - 50 and 50. I’ve looked at a few posts abuout random numbers but can’t figure this out.


#2

I have figured it out.


#3

What was the function you used?


#4

[[Math.floor(Math.random() * 280 - 140)]]

Basically multiply the number by 280 then minus half that nuber to balance the random numbers over zero. I’m now stuck trying to get it to only trigger when on the game board. I have the logic right but it isn’t paying any attention to whether it is still on the game board or not.