rand ( ) function will generate odd or even number with equal probability . If rand ( ) generates odd number , the function will return 1 else it will return 0.
return Math . floor ( Math . random ( ) * 10 ) & 1 ; }