commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmed Abdeen Hamed <ahmed.elma...@gmail.com>
Subject Re: [math] Re: binomial random generator
Date Sun, 23 Oct 2011 03:40:35 GMT
Hi Phil,

Thanks very much for your quick response. I am doing some simulations that
produce probailities which are in turn must be compared to certains rates.
Here is an example of what I am doing:

  if (randBinomial.nextBinomial(1, Simulation.MRATE)==1) {

// the condition can be replaced by the following uncommented condition

//randM.nextDouble() < Simulation.M_RATE;

  if (gt[i] == 0) {

   gt[i] = 1;

  } else {

   gt[i] = 0;

  }

  }

Please let me know if I am using Binomial object and its method correctly.

Thanks again!

Ahmed


On Sat, Oct 22, 2011 at 11:29 PM, Phil Steitz <phil.steitz@gmail.com> wrote:

> On 10/22/11 8:15 PM, Ahmed Abdeen Hamed wrote:
> > Hello friends,
> >
> > I am using the following code in a program I am writing:
> >     private static JDKRandomGenerator rg = new JDKRandomGenerator();
> >     private static RandomDataImpl randBinomial = new RandomDataImpl(rg);
> >
> > However, it is slowing down things very much. When I replace generator
> with
> > a java.util.Random object it works fine without the performance issues.
> Is
> > that expected with this library? Is there any work around? My programs
> are
> > very time consuming and I have been repeatedly running them. I really
> need
> > some tips if there is anything I can do to enhance the performance.
>
> That depends on how you are using randBinomial above.  Can you share
> the code that uses randBinomial and what you mean by "replace
> generator with a java.util.Random object?"  It will also help to
> describe what exactly you are trying to accomplish with the code.
>
> Phil
> >
> > Thanks very much!
> > Ahmed
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

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