commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: [math] Re: binomial random generator
Date Sun, 23 Oct 2011 03:46:07 GMT
On Sat, Oct 22, 2011 at 8:40 PM, Ahmed Abdeen Hamed <ahmed.elmasri@gmail.com
> wrote:

> ...
> 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;
>

I see no need to use the fancy binomial generator here.  The place that it
becomes interesting is where n >> 1.  For your problem, what you have is
really better.


>  if (gt[i] == 0) {
>   gt[i] = 1;
>  } else {
>   gt[i] = 0;
>  }
>

This can probably be replaced by

    gt[i] = 1 - gt[i]

(depending on what the original contents are, that is).

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