uboot/include/rand.h
<<
>>
Prefs
   1/* 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 *
  25 * Return:      next random number in the sequence
  26 */
  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 *
  35 * @seedp:      seed value to use, updated on exit
  36 * Return:       next random number in the sequence
  37 */
  38unsigned int rand_r(unsigned int *seedp);
  39
  40#endif
  41