Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rand(3C) — bsd — Apollo Domain/OS SR10.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

random(3)

RAND(3C)                             BSD                              RAND(3C)



NAME
     rand, srand - random number generator

SYNOPSIS
     #include <stdlib.h>

     int rand()

     void srand(seed)
     unsigned int seed;

DESCRIPTION
     The newer random(3) should be used in new applications; rand remains for
     compatibilty.

     The rand function uses a multiplicative congruential random number
     generator with period 2**32 to return successive pseudo-random numbers in
     the range from 0 to RAND_MAX.

     The sequence of numbers is determined by the seed provided as a starting
     point.  The srand function uses seed to initialize the sequence of
     psuedo-random numbers returned by rand.  A given seed will always cause
     rand to generate the same sequence of numbers.  Before the first call to
     srand (if any), rand behaves as if provided with a seed of 1.

SEE ALSO
     random(3).

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026