Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rand(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

rand, srand

Purpose

     Generates pseudo-random numbers.

Library

     Standard C Library (libc.a)

Syntax

     int rand ( )                              void srand (seed);
                                               unsigned int seed;
     Description

     The rand  subroutine generates  a random numbers  using a
     multiplicative congruential algorithm.  The random-number
     generator has a  period of 2(32), and  it returns succes-
     sive  pseudo-random  numbers  in  the  range  from  0  to
     2(15) - 1.

     The srand  subroutine resets the  random-number generator
     to a  random starting point.  The  generator is initially
     seeded with a value of 1.

     Note:  The rand subroutine is a very simple random-number
     generator.   Its  spectral properties,  the  mathematical
     measurement of  how "random" the number  sequence is, are
     somewhat  weak.   See  "drand48"  for  a  more  elaborate
     random-number generator that  has better spectral proper-
     ties.

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