Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2)

Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2)

Post by John G Har » Mon, 03 May 2010 02:21:23



<snip>
<snip>

In case anyone has been confused by VK here are some facts.

round 0.9 is 1.0

floor 0.9 is 0.0


John
--
John Harris
 
 
 

Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2)

Post by John G Har » Mon, 03 May 2010 02:25:10


<snip>
<snip>
<snip>

The FAQ is correct already.

Would beginners benefit from seeing a slightly faster routine for a
special case ?

John
--
John Harris