srand

 

Description

The srand function sets the starting point for generating a series of pseudorandom integers.

Syntax

void srand( unsigned int n )

Parameters

n
[input] a random starting point for random-number generation

Return

None.

Examples

EX1

#include <origin.h>

int test_srand()
{
    int nn;
    srand(1);
    nn = rand();
    out_int("rand()=", nn);
    
    srand(1000);
    nn = rand();
    out_int("rand()=", nn);
    return 1;
}

Remark

See Also

rand

header to Include

origin.h

Reference