rand()

generate random number 

Function


SYNOPSIS

#include <stdlib.h>

int rand(void);


DESCRIPTION

The rand() function generates pseudo-random numbers with period 2^32 in the range from 0 to RAND_MAX. The function uses a seed value to generate the pseudo-random number. The seed has an initial value of 1 but it can be changed by calling srand().

rand() is not reentrant; see rand_r().


PARAMETERS

None.


RETURN VALUES

rand() returns a pseudo-random number between 0 and RAND_MAX.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

Unsafe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
rand_r(), random(), srand(), srandom()


PTC MKS Toolkit 10.5 Documentation Build 40.