Class Binomial
java.lang.Object
eduni.distributions.Generator
eduni.distributions.Binomial
- All Implemented Interfaces:
DiscreteGenerator, Seedable
A random number generator based on the Binomial distribution.
-
Constructor Details
-
Binomial
public Binomial(double prob, int trials) the seed is automatically provided by theSeedGenerator- Parameters:
prob- The probability of success in a trialtrials- The number of trials
-
Binomial
public Binomial(double prob, int trials, long seed) The constructor with which a specific seed is set for the random number generator- Parameters:
prob- The probability of successtrials- The number of trialsseed- The initial seed for the generator, two instances with the same seed will generate the same sequence of numbers
-
-
Method Details
-
sample
public long sample()Generate a new random number.- Specified by:
samplein interfaceDiscreteGenerator- Returns:
- The next random number in the sequence
-
toString
-