1.Dd September 6, 2001 2.Dt RANDOM 4 3.Os Darwin 4.Sh NAME 5.Nm random 6, 7.Nm urandom 8.Nd random data source devices. 9.Sh SYNOPSIS 10.Cd "pseudo-device random" 11.Sh DESCRIPTION 12The 13.Nm 14device produces uniformly distributed random byte values 15of potentially high quality. 16.Pp 17To obtain random bytes, open 18.Nm /dev/random 19for reading and read from it. 20.Pp 21The same random data is also available from 22.Xr getentropy 2 . 23Using the 24.Xr getentropy 2 25system call interface will provide resiliency to file descriptor exhaustion, chroot, or sandboxing which can make 26.Nm /dev/random 27unavailable. Additionally, the 28.Xr arc4random 3 29API provides a fast userspace random number generator built on the 30.Nm 31data source and is preferred over directly accessing the system's random device. 32.Pp 33.Nm /dev/urandom 34is a compatibility nod to Linux. On Linux, 35.Nm /dev/urandom 36will produce lower quality output if the entropy pool drains, while 37.Nm /dev/random 38will prefer to block and wait for additional entropy to be collected. 39With Fortuna, this choice and distinction is not necessary, and 40the two devices behave identically. You may use either. 41.Pp 42The 43.Nm 44device implements the 45.Nm Fortuna 46pseudo random number generator algorithm and maintains its entropy pool. 47The kernel automatically seeds the algorithm with additional entropy during normal execution. 48.Sh FILES 49.Bl -tag -width /dev/urandom -compact 50.It Pa /dev/random 51.It Pa /dev/urandom 52.El 53.Sh HISTORY 54A 55.Nm 56device appeared in the Linux operating system. 57