srand function(Seed Pseudo-Random Number Generator) in C Language – example and detail

In the C Programming Language, the srand characteristic initializes the sequence of pseudo-random numbers generated when the rand function is called.

Syntax

The syntax for the srand characteristic in the C Language is:

void srand(unsigned int seed);

Parameters or Arguments

seed The seed cost for the rand function. The seed fee determines a specific sequence of random numbers when calling the rand function. If a application continually makes use of the same seed value, the rand function will constantly get the equal sequence of numbers.

Returns

The srand functiondoes not return anything.

Required Header

In the C Language, the required header for the srand feature is:

#include <stdlib.h>

Applies To

In the C Language, the srand characteristic can be used in the following versions:

ANSI/ISO 9899-1990

Similar Functions

Other C features that are comparable to the srand function:

rand function <stdlib.h>