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 Mon, 26 Oct 2009 22:16:35 GMT
If you define this new interface, can't you just put the correct
implementation of the generator into some abstract class somewhere and make
sure that all of the distributions implement this.  That implementation can
check if this extends DistributionWithInverseCumulativeProbability.  If it
does, then generating a sample is easy.  If not, throwing
UnImplementedOperation would be in order.

For that matter, would it be better to just insert an abstract class named
DistributionWithInverseCumulativeProbability somewhere in the inheritance
chain?  Do we need the interface at all?

On Mon, Oct 26, 2009 at 3:09 PM, Mikkel Meyer Andersen <> wrote:

> Dear community.
> I've just started using the Apache Commons Math library. In regards to
> generating random data from probability distributions, the library
> doesn't support generating random data using the inverse cdf method
> although a lot of the distributions gives the possibility to calculate
> the inverse cdf.
> Are there any particular good reason for this?
> If not, I would create a public interface
> DistributionWithInverseCumulativeProbability (who has a better name?)
> with the method inverseCumulativeProbability (right now it's on
> ContinuousDistribution and some other subclasses and don't seem to be
> gathered in an interface) and all the distributions with the
> inverseCumulativeProbability-method should implement this interface.
> 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.
> What do you think about that idea? I look forward to comments,
> suggestions, and preferably, better names :-).
> Cheers, Mikkel Meyer Andersen.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Ted Dunning, CTO

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