Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

drand48(3C)

RAND(3C)

NAME

rand, srand − simple random-number generator

SYNOPSIS

int rand ( )

void srand (seed)
unsigned seed;

HP-UX COMPATIBILITY

Level: HP-UX/RUN ONLY

Origin: System V

DESCRIPTION

Rand uses a multiplicative congruential random-number generator with period 232 that returns successive pseudo-random numbers in the range from 0 to 215−1. 

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

NOTE

The spectral properties of rand leave a great deal to be desired.  Drand48(3C) provides a much better, though more elaborate, random-number generator.

SEE ALSO

drand48(3C). 

Hewlett-Packard  —  last mod. May 11, 2021

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