## random

#### OS/161 Reference Manual

### Name

random - pseudorandom number generation

### Library

Standard C Library (libc, -lc)

### Synopsis

#include <stdlib.h>
long
random(void);
void
srandom(unsigned long seed);

### Description

random returns a number between 0 and 0x7fffffff (RAND_MAX). This number is selected using a rather complex generator which is believed to generate randomness of an acceptable (though not cryptographic) quality. Unlike with some generators, all bits of the values returned are random.

srandom initializes the generator state based on the passed-in seed. If srandom is not called, the sequence of numbers returned by random is the same as if srandom had been called with a seed of 1.

The implementation of random and srandom used in OS/161 is software developed by the University of California, Berkeley and its contributors.