188
rated 0 times
[
194]
[
6]
/ answers: 1 / hits: 97100
/ 7 Years ago, mon, july 17, 2017, 12:00:00
I am trying to generate random 0 or 1 as I am writing a script to populdate my database. If it is 1, I will save it as male and 0 the other way around.
Inside my JavaScript:
Math.floor((Math.random() * 1) + 1);
I used this to generate either 1 or 0. However, with the code above, it always return me with 1. Any ideas?
More From » javascript