blob: 4c54fbbd104232c3c6fdc3b602bccafb1e54881e [file] [log] [blame]
Simon Glass840ef4d2019-11-14 12:57:13 -07001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * (C) Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
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 */
20void srand(unsigned int seed);
21
22/**
23 * rand() - Get a 32-bit pseudo-random number
24 *
Heinrich Schuchardtc7ff87e2020-06-13 12:29:52 +020025 * Return: next random number in the sequence
Simon Glass840ef4d2019-11-14 12:57:13 -070026 */
27unsigned 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 *
Heinrich Schuchardtc7ff87e2020-06-13 12:29:52 +020035 * @seedp: seed value to use, updated on exit
36 * Return: next random number in the sequence
Simon Glass840ef4d2019-11-14 12:57:13 -070037 */
38unsigned int rand_r(unsigned int *seedp);
39
40#endif