RANDOM(4)

NAME
random, urandom - random data source device

SYNOPSIS
#include <sys/types.h>
#include <dev/rndvar.h>

DESCRIPTION
The urandom device produces high quality pseudo-random output data without ever blocking, even immediately after booting. Entropy data is collected from system activity (such as disk, network, and clock device interrupts), and then used to key a stream cipher to generate the output.

The urandom device is intended to be used in scripts. In C programs, use the arc4random(3) family of functions instead, which can be called in almost all coding environments, including pthreads(3), chroot(2), and pledge(2), and which avoids accessing a device every time.

Never use /dev/random. On OpenBSD, it does the same as /dev/urandom, but on many other systems, it misbehaves. For example, it may block, directly return entropy instead of using a stream cipher, or only return data from hardware random generators.

FILES
/dev/urandom

SEE ALSO
arc4random(3), amdpm(4), glxsb(4), pchb(4), arc4random(9)

HISTORY
A random device first appeared in Linux in 1994. The random and urandom devices have been available since OpenBSD 2.0.

BUGS
No randomness testing suite provided.