_lrand
Remonter à stdlib.h - Index
Header File
stdlib.h
Category
Math Routines
Prototype
long _lrand(void);
Description
_lrand is the long random number generator function. _rand uses a multiplicative congruential random number generator with period 2^64 to return successive pseudo-random numbers in the range from 0 to 2^31 - 1.
The generator is reinitialized by calling srand with an argument value of 1. It can be set to a new starting point by calling srand with a given seed number.
Example
#include <stdlib.h> #include <stdio.h> int main(void) { long i; randomize(); printf("Ten random numbers from 0 to 99\n\n"); for(i=0; i<10; i++) printf("%d\n", _lrand() % 100); return 0; }