rand10=Math.floor(Math.random())*10 // before
rand10=0|Math.random()*10 // after
The first is not random, it will always return zero (this error is very common). The second happens to be ok because * binds tighter than |. However, this is order-dependent.