Embedded Artistry Framework
Embedded Systems C++ Framework
Functions | Variables
rand.c File Reference
#include <stdlib.h>
Include dependency graph for rand.c:

Functions

static int do_rand (unsigned long *ctx)
 
int rand_r (unsigned int *ctx)
 
int rand ()
 Returns a pseudo-random integer value between ​0​ and. More...
 
void srand (unsigned int seed)
 

Variables

static unsigned long next = 1
 

Function Documentation

◆ do_rand()

static int do_rand ( unsigned long *  ctx)
static

References RAND_MAX.

Referenced by rand(), and rand_r().

◆ rand()

int rand ( void  )

Returns a pseudo-random integer value between ​0​ and.

See also
RAND_MAX (0 and
RAND_MAX included).

Returns a pseudo-random integer value between ​0​ and

See also
RAND_MAX (0 and
RAND_MAX included).
srand() seeds the pseudo-random number generator used by rand. If rand is used before any calls to
srand, rand behaves as if it was seeded with
srand. Each time rand is seeded with srand, it must produce the same sequence of values.

rand is not guaranteed to be thread-safe.

Returns
Pseudo-random integer value between ​0​ and RAND_MAX, inclusive.

Referenced by main().

Here is the caller graph for this function:

◆ rand_r()

int rand_r ( unsigned int *  ctx)

◆ srand()

void srand ( unsigned int  seed)

References next, and seed.

Variable Documentation

◆ next

unsigned long next = 1
static