User Tools

Site Tools


set_random_source

Table of Contents

Synopsis:

set random_source [<0|1|2|3>]

Description:

The random function generates random numbers. But what is a random number? A random number generator is often measured by 3 attributes

Entropy Given a set of the last <N> random numbers, how likely is it you can guess the next random number? (High entropy means less guessability)
Distribution Given a set of the last <N> random numbers, how likely is it each of the possible values of <N> have appeared the same number of times? (High distribution means every value is hit the same number of times)
Repeatability Given a set of the first <N> random numbers, how likely is it that you can create the same <N> random numbers again? (High repeatability means you can regenerate the same sequence upon request)

A discussion of the pros and cons of each of these attributes is beyond the scope of this document. But the client has 4 random number generators:

Value Description Entropy Distribution Repeatability
0 Reads from /dev/urandom High Medium No
1 Traditional ircII PRNG Low High Yes
2 gettimeofday() calls Medium Low No
3 arc4random PRNG High Medium No

The factory default value is 0. Although you can set the value to other than 0, 1, 2, or 3, any other values are treated as though you had set it to 3. If /dev/urandom is not available, then 0 behaves as though you had set it to 1.

The random number generator is used by rand and randread

History:

The set random_source variable first appeared in EPIC4pre2.001-NR13. Arc4random support (set random_source 3) first appeared in EPIC4-1.1.8.

#$EPIC: set_random_source.txt,v 1.5 2006/09/19 03:45:37 jnelson Exp $

set_random_source.txt · Last modified: 2006/09/19 03:45 (external edit)