RandomCast
Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.

Severity
ERROR

The problem

Math.random(), Random#nextFloat, and Random#nextDouble return results in the range [0.0, 1.0). Therefore, casting the result to (int) or (long) always results in the value of 0.

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("RandomCast") to the enclosing element.