annotate src/lib/rand.h @ 22664:fea53c2725c0

director: Fix director_max_parallel_moves/kicks type Should be uint, not time.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 09 Nov 2017 12:24:16 +0200
parents f9deece0002f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17530
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
1 #ifndef RAND_H
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
2 #define RAND_H
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
3
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
4 /* Wrap srand() so that we can reproduce fuzzed tests */
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
5
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
6 /* If we have seeded the prng precisely once, and we remember what
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
7 * value that was with, then we can reproduce any failing test cases
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
8 * that depend on that randomness by forcing the seed value (e.g.
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
9 * in a debugger, by putting a breakpoint on rand_set_seed()).
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
10 */
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
11
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
12 /* Number of times we've been seeded */
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
13 int rand_get_seed_count(void);
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
14 /* That last seed */
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
15 unsigned int rand_get_last_seed(void);
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
16 /* Actually seed the prng (could add char* for name of function?) */
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
17 void rand_set_seed(unsigned int s);
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
18
f9deece0002f lib: add rand helper library
Phil Carmody <phil@dovecot.fi>
parents:
diff changeset
19 #endif