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