A Bernoulli distribution is equivalent to a binomial distribution with only 1 trial i.e. BinomialDistribution(1,p)
from the Apache Commons Math library. A Bernoulli distribution is obviously a much simpler thing than the general binomial distribution.
If performance matters, should I roll my own BernoulliDistribution(p)
by subclassing AbstractIntegerDistribution
, or would I get almost the same performance by just going with BinomialDistribution(1,p)
?