NEURON
Poisson.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 
3 /*
4 Copyright (C) 1988 Free Software Foundation
5  written by Dirk Grunwald (grunwald@cs.uiuc.edu)
6 
7 This file is part of the GNU C++ Library. This library is free
8 software; you can redistribute it and/or modify it under the terms of
9 the GNU Library General Public License as published by the Free
10 Software Foundation; either version 2 of the License, or (at your
11 option) any later version. This library is distributed in the hope
12 that it will be useful, but WITHOUT ANY WARRANTY; without even the
13 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the GNU Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 #ifdef __GNUG__
20 #pragma implementation
21 #endif
22 #include <Random.h>
23 #include <Poisson.h>
24 
26 {
27  double bound = exp(-1.0 * pMean);
28  int count = 0;
29 
30  for (double product = 1.0;
31  product >= bound;
32  product *= pGenerator -> asDouble()) {
33  count++;
34  }
35  return(count - 1);
36 }
double pMean
Definition: Poisson.h:28
static double product(VEC *a, double offset, int *expt)
Definition: itersym.c:281
exp
Definition: extdef.h:3
RNG * pGenerator
Definition: Random.h:34
virtual double operator()()
Definition: Poisson.cpp:25