Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rand(III) — UNIX 6th Edition

Media Vault

Software Library

Restoration Projects

Artifacts Sought

RAND(III)  −  PWB/UNIX 1/15/73

NAME

rand, srand − random number generator

SYNOPSIS

(seed in r0)
jsrpc,srand/to initialize jsrpc,rand/to get a random number

srand(seed)
int seed;
rand( )

DESCRIPTION

Rand uses a multiplicative congruential random number generator to return successive pseudo-random numbers (in r0) in the range from 0 to 215−1.  The generator is reinitialized by calling srand with 1 as argument (in r0).  It can be set to a random starting point by calling srand with whatever you like as argument, for example the low-order word of the time. 

BUGS

The low-order bits are not very random. 

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