Groovy Documentation

groovy.org.codenarc.rule.basic
[Groovy] Class RandomDoubleCoercedToZeroRule

java.lang.Object
  org.codenarc.rule.AbstractAstVisitorRule
      groovy.org.codenarc.rule.basic.RandomDoubleCoercedToZeroRule

class RandomDoubleCoercedToZeroRule
extends AbstractAstVisitorRule

The Math.random() method returns a double result greater than or equal to 0.0 and less than 1.0. If you coerce this result into an Integer or int, then it is coerced to zero. Casting the result to int, or assigning it to an int field is probably a bug.

Authors:
Hamlet D'Arcy


Property Summary
Class astVisitorClass

String name

int priority

 

Property Detail

astVisitorClass

Class astVisitorClass


name

String name


priority

int priority


 

Groovy Documentation