NEURON
mcran4.h
Go to the documentation of this file.
1 #ifndef mcran4_h
2 #define mcran4_h
3 
4 #include <nrnconf.h>
5 #if defined(HAVE_STDINT_H)
6 #include <stdint.h>
7 #endif
8 
9 #if defined(__cplusplus)
10 extern "C" {
11 #endif
12 
13 extern void mcell_ran4_init(uint32_t);
14 extern double mcell_ran4(uint32_t* high, double* x, unsigned int n, double range);
15 extern double mcell_ran4a(uint32_t* idx1);
16 extern uint32_t mcell_iran4(uint32_t* idx1);
17 extern double nrnRan4dbl(uint32_t* idx1, uint32_t idx2);
18 extern uint32_t nrnRan4int(uint32_t* idx1, uint32_t idx2);
19 
20 #if defined(__cplusplus)
21 }
22 #endif
23 
24 #endif
25 
26 /*
27  The original ran4 generator was copyrighted by "Numerical Recipes in C"
28  and therefore has been removed from the NEURON sources and replaced by code
29  fragments obtained from http://www.inference.phy.cam.ac.uk/bayesys/
30  by John Skilling
31  The function mcell_ran4a only returns
32  a single uniform random number in the distribution 0.0 to 1.0 .
33  The prototype for mcell_ran4 is the original.
34 */
35 
36 /*
37 Michael Hines added the prefix mcell to the global names.
38 These functions were obtained from Tom Bartol <bartol@salk.edu>
39 who uses them in his mcell program.
40 He comments:
41 For MCell, Ran4 has the distinct advantage of generating
42 streams of random bits not just random numbers. This means that you can
43 break the 32 bits of a single returned random number into several smaller
44 chunks without fear of correlations between the chunks. Ran4 is not the
45 fastest generator in the universe but it's pretty fast (16 million
46 floating point random numbers per second on my 1GHz Intel PIII and 20
47 million integer random numbers per second) and of near cryptographic
48 quality. I've modified it so that a given seed will generate the same
49 sequence on Intel, Alpha, RS6000, PowerPC, and MIPS architectures (and
50 probably anything else out there). It's also been modified to generate
51 arbitrary length vectors of random numbers. This makes generating numbers
52 more efficient because you can generate many numbers per function call.
53 MCell generates them in chunks of 10000 at a time.
54 */
uint32_t nrnRan4int(uint32_t *idx1, uint32_t idx2)
Definition: mcran4.cpp:107
uint32_t mcell_iran4(uint32_t *idx1)
Definition: mcran4.cpp:69
double nrnRan4dbl(uint32_t *idx1, uint32_t idx2)
Definition: mcran4.cpp:162
double mcell_ran4(uint32_t *high, double *x, unsigned int n, double range)
Definition: mcran4.cpp:57
double mcell_ran4a(uint32_t *idx1)
Definition: mcran4.cpp:65
void mcell_ran4_init(uint32_t)
Definition: mcran4.cpp:53
int const size_t const size_t n
Definition: nrngsl.h:11