package ac.essex.gp.nodes.ercs;

import ac.essex.gp.params.NodeParams;
import ac.essex.gp.params.RangeTypes;

/**
 * Returns values in the range 0-255. Jittering will not take it beyond these boundaries.
 * This is best suited for 8 bit colour imagery.
 *
 * @author Olly Oechsle, University of Essex, Date: 22-Feb-2007
 * @version 1.0
 */
public class LargeIntERC extends BasicERC {

    public void jitter() {
        // plus or minus 10%
        value *= (1.1 - (Math.random() * 0.2));
        if (value > 255) value = 255;
        else if (value < 0) value = 0;
    }

    public double setValue() {
        return Math.random() * 255;
    }

    public int getReturnType() {
        return NodeParams.NUMBER;
    }

    public int getRangeID() {
        return RangeTypes.RANGE_8BIT_INT;
    }
    
}
