2.1.16.1.15 rand


Description

The rand function returns a pseudorandom integer in the range 0 to RAND_MAX.

Syntax

int rand( )

Parameters

Return

The rand returns a pseudorandom number.

Examples

EX1

//This program seeds the random-number generator.

int test_rand()
{
    int nn1, nn2;
    nn1 = rand();
    out_int("rand()=", nn1);
    nn2 = rand();
    out_int("rand()=", nn2);
    
    return 1;
}

Remark

See Also

rnd

Header to Include

origin.h

Reference