All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.keenon.lense.gameplay.distributions.DiscreteSetDistribution Maven / Gradle / Ivy

There is a newer version: 1.2.17
Show newest version
package com.github.keenon.lense.gameplay.distributions;

import java.util.Random;

/**
 * Created by keenon on 9/25/15.
 *
 * Draws randomly, with replacement, from a given set of values
 */
public class DiscreteSetDistribution extends ContinuousDistribution {
    long[] potentialValues;

    public DiscreteSetDistribution(long[] potentialValues) {
        this.potentialValues = potentialValues;
    }

    @Override
    public long drawSample(Random r) {
        return potentialValues[r.nextInt(potentialValues.length)];
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy