org.tolven.gen.model.PoissonValueGen.java Source code

Java tutorial

Introduction

Here is the source code for org.tolven.gen.model.PoissonValueGen.java

Source

/*
 *  Copyright (C) 2006 Tolven Inc 
 *
 * This library is free software; you can redistribute it and/or modify it under the terms of 
 * the GNU Lesser General Public License as published by the Free Software Foundation; either 
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU Lesser General Public License for more details.
 * 
 * Contact: info@tolvenhealth.com
 */
package org.tolven.gen.model;

import org.apache.commons.math.random.RandomData;

public class PoissonValueGen extends ValueGen {
    private double mean;

    public double generate(RandomData rng) {
        return rng.nextPoisson(mean);
    }

    public PoissonValueGen(double mean) {
        this.mean = mean;
    }

    public double getMean() {
        return mean;
    }

    public void setMean(double mean) {
        this.mean = mean;
    }

}