This is driving me crazy.

I'm expecting this to generate a random number between 0 and 2 in Java.

int x = (int)(Math.random()*2);

However it's only generating 0s and 1s. What am I doing wrong here?

Thanks,

Strick