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