commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <>
Subject Re: [math] Generate random data using the Inverse CDF Method?
Date Tue, 27 Oct 2009 00:21:00 GMT
It is similar to what RandomDataImpl does, but the current type hierarchy is
a problem because it over-uses that interface/factory/implementation
pattern.  The result is confusing as can be, especially since virtually all
of the distributions have just one implementation and the factories aren't
polymorphic.  This causes the reader (*this* reader anyway) to be completely
convinced that there is more code hidden somewhere.

The approach suggested by Mikkel seems much better than the current one.

On Mon, Oct 26, 2009 at 4:50 PM, Phil Steitz <> wrote:

> > With this small change, a new class called
> > RandomDistributionWithInverseCumulativeProbability (again, who has a
> > better name?) could simply use the uniform generator and a class
> > implementing DistributionWithInverseCumulativeProbability to generate
> > random data from that distribution.
> This is essentially what RandomDataImpl does for the distributions
> that it supports. Support for more distributions would be a welcome
> addition.  I guess along the lines of what you are talking about
> above, it might make sense to add a single generic
> nextInversionDeviate method paramaterized by ContinuousDistribution.
> The implementation of this would use a uniform generator and
> inversion to generate deviates.  That would be simpler than creating
> separate classes for each distribution or adding random data
> generation to the distributions themselves.  It would also be more
> consistent with the current organization of the code, which locates
> random data generation in the random package.

Ted Dunning, CTO

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message