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