srand()

Defines the initial value for the function rand().

Synopsis

void srand([int seed]);

Parameters

Parameter Description
seed Basic value

Return value

None

Errors

missing/incorrect argument

Description

The function srand() is used to define the initial value for the function rand(). The argument seed is optional. if it is not specified, the current system time is used as the initialization value for srand().

Example

main()
{
  srand(1);
  DebugN(rand());
}

Assignment

Miscellaneous functions

Availability

CTRL