libsc  2.8.7
The SC library provides support for parallel scientific applications.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sc_random.h
Go to the documentation of this file.
1 /*
2  This file is part of the SC Library.
3  The SC Library provides support for parallel scientific applications.
4 
5  Copyright (C) 2010 The University of Texas System
6  Additional copyright (C) 2011 individual authors
7 
8  The SC Library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  The SC Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with the SC Library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 */
23 
24 #ifndef SC_RANDOM_H
25 #define SC_RANDOM_H
26 
31 #include <sc.h>
32 
36 typedef uint64_t sc_rand_state_t;
37 
42 double sc_rand (sc_rand_state_t * state);
43 
54  double *second_result);
55 
61 int sc_rand_small (sc_rand_state_t * state, double d);
62 
68 int sc_rand_poisson (sc_rand_state_t * state, double mean);
69 
70 #endif /* !SC_RANDOM_H */
Support for process management (memory allocation, logging, etc.)
int sc_rand_small(sc_rand_state_t *state, double d)
Randomly draw either 0 or 1 where the probability for 1 is small.
double sc_rand_normal(sc_rand_state_t *state, double *second_result)
Sample the Gauss standard normal distribution.
uint64_t sc_rand_state_t
The internal state of sc_rand and derived functions.
Definition: sc_random.h:36
double sc_rand(sc_rand_state_t *state)
Draw a (pseudo-)random variable uniformly distributed in [0, 1).
int sc_rand_poisson(sc_rand_state_t *state, double mean)
Draw from a random variable following the Poisson distribution.