Returns pseudorandom numbers in the range 0 to 2[31] - 1.
#include <math.h> int rand (void);
static unsigned int next = 1;
int rand(void)
{
next = next * 1103515245 + 12345;
return (next & RAND_MAX);
}
See also srand in this section.
For other random number algorithms, see random and all the *48 functions.