blob: b993e1a4203843060fb67fe8f2b331be5a718d96 (
plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/* utility.c - burneye2 supporting functions, include file
*
* by scut
*/
#ifndef UTILITY_H
#define UTILITY_H
/* fnote
*
* output format message `fmt' to stderr when verbosity is set.
*
* return length of message send to stderr
*/
int
fnote (const char *fmt, ...);
/* be_randinit_file
*
* initialize the random functions from filename `filename'.
*
* return in any case
*/
void
be_randinit_file (const char *filename);
/* be_randinit
*
* initialize the random functions of burneye.
*
* return in any case
*/
void
be_randinit (void);
/* be_randend
*
* close the random file descriptor.
*
* return in any case
*/
void
be_randend (void);
/* be_random
*
* generate a random number
*
* return a random number between 0 and `max'-1.
*/
unsigned int
be_random (unsigned int max);
/* be_random_coin
*
* throw a biased coin with probability `prob'.
*
* return 1 in case the `prob'-probable case was the result
* return 0 otherwise
*/
int
be_random_coin (double prob);
/* be_random_prob
*
* do a probabilistic random decision. probabilities are relative and given
* through `items_prob', which should be an all-positive array with
* `items_count' elements.
*
* return the index of the array that made it
*/
unsigned int
be_random_prob (unsigned int items_count, double *items_prob);
#endif
|