You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Renaud, Martin" <Ma...@nuance.com> on 2010/05/21 00:04:30 UTC

[Math] Generate pseudo random number that obey a given distribution

Hi,

 

I didn't for that in the doc, so maybe I'm asking the wrong question.
Tell me if it's the case.

 

I would like to generate random numbers that fits a given distribution.

 

The code I'd like to write:

 

Distribution distribution = new NormalDistributionImpl(); // this exists
so far...

RandomGenerator generator = new DistributionGenerator(distribution); //
this subclass does not exist.

generator.setSeed(1234);

 

Doing a graph with many values obtained with generator.nextDouble()
would give me a nice bell-curve. Other distribution could also be used.

 

Is this is possible or I'm asking something that is mathematically or
computationally impossible... ? 

 

Thanks for your input,

 

-Martin


RE: [Math] Generate pseudo random number that obey a given distribution

Posted by "Renaud, Martin" <Ma...@nuance.com>.
This is exactly what I was looking for... I looked at the class, but
didn't realized I was what I looked for...

Thanks for the pointer.

-Martin

-----Original Message-----
From: Gilles Sadowski [mailto:gilles@harfang.homelinux.org] 
Sent: Thursday, May 20, 2010 6:33 PM
To: user@commons.apache.org
Subject: Re: [Math] Generate pseudo random number that obey a given
distribution

Hi.

> 
> I didn't for that in the doc, so maybe I'm asking the wrong question.
> Tell me if it's the case.
> 
>  
> 
> I would like to generate random numbers that fits a given
distribution.
> [...]

Did you have a look at at the "RandomData" interface (and
"RandomDataImpl"
class)?  It contains methods such as "nextUniform", "nextGaussian", etc.


Best regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [Math] Generate pseudo random number that obey a given distribution

Posted by Gilles Sadowski <gi...@harfang.homelinux.org>.
Hi.

> 
> I didn't for that in the doc, so maybe I'm asking the wrong question.
> Tell me if it's the case.
> 
>  
> 
> I would like to generate random numbers that fits a given distribution.
> [...]

Did you have a look at at the "RandomData" interface (and "RandomDataImpl"
class)?  It contains methods such as "nextUniform", "nextGaussian", etc.


Best regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org