sPyNNaker neural_modelling  7.4.2
rng.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 The University of Manchester
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __RNG_H__
18 #define __RNG_H__
19 
24 #include <common-typedefs.h>
25 #include <random.h>
26 
30 typedef struct rng {
31  mars_kiss64_seed_t seed;
32 } rng_t;
33 
42 
48 uint32_t rng_generator(rng_t *rng);
49 
55 accum rng_exponential(rng_t *rng);
56 
62 accum rng_normal(rng_t *rng);
63 
69 
73 extern rng_t *population_rng;
74 
78 extern rng_t *core_rng;
79 
80 #endif
static mars_kiss64_seed_t seed
YUCK copy and pasted RNG to allow inlining and also to avoid horrific executable bloat.
Definition: random_util.h:31
accum rng_exponential(rng_t *rng)
Generate an exponentially-distributed random number.
Definition: rng.c:30
accum rng_normal(rng_t *rng)
Generate an normally-distributed random number.
Definition: rng.c:34
rng_t * core_rng
An RNG that is local to the current core.
rng_t * rng_init(void **region)
Initialise the random number generator.
void rng_free(rng_t *rng)
Finish with a random number generator.
rng_t * population_rng
An RNG that starts in the same place on every core of the Population.
uint32_t rng_generator(rng_t *rng)
Generate a uniformly-distributed random number.
Definition: rng.c:26
The Random number generator parameters.
Definition: rng.h:30
region
spike source array region IDs in human readable form
static uint32_t rng(void)
Random number generation for the Poisson sources. This is a local version for speed of operation.