-
Notifications
You must be signed in to change notification settings - Fork 5
/
random.h
51 lines (43 loc) · 1022 Bytes
/
random.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Written by Tony Finch <[email protected]> <[email protected]>
*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*/
/*
* uniform unsigned integers in [0,limit)
*/
uint32_t rand_lemire(uint32_t limit);
/*
* uniform in (0,1)
*/
double rand_uniform(void);
/*
* exponential distribution with mean 1
*/
double rand_exponential(void);
/*
* pareto distribution with mean inf
*/
double rand_pareto(void);
/*
* gamma distribution with mean 1 shape k scale 1/k
*/
double rand_gamma(unsigned k);
/*
* normal distribution with mean 0 and sigma 1
*/
double rand_normal(void);
/*
* log normal distribution with mean exp(0.5)
*/
double rand_lognormal(void);
/*
* chi squared distribution with k degrees of freedom mean 1
*/
double rand_chisquared(unsigned k);