Can you randomly bitwise shift an integer left or right?

I encountered an IllegalArgumentException for Random class when I’m randomizing my bitwise shift factor in one direction.


this.pixels[tgt + xx] = biomeColor - (biomeColor >> r.nextInt(4));

I thought this is allowed. Or I’m not doing it right?