0

How to generate random numbers btwn -1 and 1 in js ?

I'm trying to generate random number between -1 and 1.

13th May 2018, 9:09 AM
S O U ✌️ I K
S O U ✌️ I K - avatar
4 Answers
+ 2
// integer n = (Math.floor(Math.random() * 3)) - 1; // float n = (Math.random() * 2) - 1;
13th May 2018, 9:58 AM
Johann
Johann - avatar
+ 2
Johann Ditrich plz explain by the way thanx
13th May 2018, 10:01 AM
S O U ✌️ I K
S O U ✌️ I K - avatar
+ 1
Donna thanx
13th May 2018, 10:22 AM
S O U ✌️ I K
S O U ✌️ I K - avatar