Manual Page Search Parameters

RANDOM(4) Device Drivers Manual RANDOM(4)

random, urandom
random data source device

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

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.


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

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

No randomness testing suite provided.
November 10, 2017 OpenBSD-current