randomize

From RAD Studio
Jump to: navigation, search

Go Up to stdlib.h Index


Header File

stdlib.h, time.h

Category

Math Routines

Prototype

void randomize(void);

Description

Initializes random number generator.

randomize initializes the random number generator with a random value.

Return Value

None.

Example

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main(void)
{
    int i;
    randomize();
    printf("Ten random numbers from 0 to 99\n\n");
    for(i=0; i<10; i++)
        printf("%d\n", rand() % 100);
    return 0;
}

Portability

POSIX Win32 ANSI C ANSI C++

+