Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rand(3C) — sysv — mips UMIPS RISC/os 4.52

Media Vault

Software Library

Restoration Projects

Artifacts Sought



RAND(3C-SysV)       RISC/os Reference Manual        RAND(3C-SysV)



NAME
     rand, srand - simple random-number generator

SYNOPSIS
     int rand ( )

     void srand (seed)
     unsigned seed;

DESCRIPTION
     rand uses a multiplicative congruential random-number gen-
     erator with period 2^32 that returns successive pseudo-
     random numbers in the range from 0 to (2^15)-1.  Note that
     although the function returns an integer, the return values
     are all positive short integer values.  Other versions of
     rand, notably from Berkeley systems, may return results with
     different ranges.

     srand can be called at any time to reset the random-number
     generator to a random starting point.  The generator is ini-
     tially seeded with a value of 1.

NOTES
     The spectral properties of rand are limited.  drand48(3C)
     provides a much better, though more elaborate, random-number
     generator.





























                         Printed 1/15/91                   Page 1



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