DEV Community

Discussion on: 9 Extremely Powerful JavaScript Hacks

Collapse
 
kh136 profile image
k

Math.random() returns a number between 0 and 1. -0.5 is so that the result is between -0.5 and 0.5. The end result is half the time the comparator will be negative and half the time it will be positive, basically a coin toss function. And no they're not, they're more like python lists.

Collapse
 
softmantk profile image
NIKHIL CM

Hi, Can you explain Why it is not like a coin toss function ? I thought it is...