]>
Commit | Line | Data |
---|---|---|
840ef4d4 SG |
1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
2 | /* | |
3 | * (C) Copyright 2000-2009 | |
4 | * Wolfgang Denk, DENX Software Engineering, [email protected]. | |
5 | */ | |
6 | ||
7 | #ifndef __RAND_H | |
8 | #define __RAND_H | |
9 | ||
10 | #define RAND_MAX -1U | |
11 | ||
12 | /** | |
13 | * srand() - Set the random-number seed value | |
14 | * | |
15 | * This can be used to restart the pseudo-random-number sequence from a known | |
16 | * point. This affects future calls to rand() to start from that point | |
17 | * | |
18 | * @seed: New seed | |
19 | */ | |
20 | void srand(unsigned int seed); | |
21 | ||
22 | /** | |
23 | * rand() - Get a 32-bit pseudo-random number | |
24 | * | |
c7ff87e0 | 25 | * Return: next random number in the sequence |
840ef4d4 SG |
26 | */ |
27 | unsigned int rand(void); | |
28 | ||
29 | /** | |
30 | * rand_r() - Get a 32-bit pseudo-random number | |
31 | * | |
32 | * This version of the function allows multiple sequences to be used at the | |
33 | * same time, since it requires the caller to store the seed value. | |
34 | * | |
c7ff87e0 HS |
35 | * @seedp: seed value to use, updated on exit |
36 | * Return: next random number in the sequence | |
840ef4d4 SG |
37 | */ |
38 | unsigned int rand_r(unsigned int *seedp); | |
39 | ||
40 | #endif |