Add srandomdev() description

This commit is contained in:
Andrey A. Chernov 1997-03-23 23:08:31 +00:00
parent 767b268b5d
commit 7b0b1b2f29

View File

@ -37,6 +37,7 @@
.Sh NAME
.Nm random ,
.Nm srandom ,
.Nm srandomdev ,
.Nm initstate ,
.Nm setstate
.Nd better random number generator; routines for changing generators
@ -46,6 +47,8 @@
.Fn random void
.Ft void
.Fn srandom "unsigned long seed"
.Ft int
.Fn srandomdev void
.Ft char *
.Fn initstate "unsigned long seed" "char *state" "long n"
.Ft char *
@ -93,6 +96,25 @@ with
as the seed.
.Pp
The
.Fn srandomdev
routine initialize a state array using
.Xr urandom 4
random number device which returns good random numbers,
suitable for cryptographic use.
Note that this particular seeding
procedure can generate states which are impossible to reproduce by
calling
.Fn srandom
with any value, since the succeeding terms in the
state buffer are no longer derived from the LC algorithm applied to
a fixed seed.
If successful
.Fn srandomdev
returns 0. It returns -1 on failure, and sets
.Va errno
to indicate the error.
.Pp
The
.Fn initstate
routine allows a state array, passed in as an argument, to be initialized
for future use. The size of the state array (in bytes) is used by
@ -155,7 +177,8 @@ detects that the state information has been garbled, error
messages are printed on the standard error output.
.Sh SEE ALSO
.Xr rand 3 ,
.Xr srand 3
.Xr srand 3 ,
.Xr urandom 4
.Sh HISTORY
These
functions appeared in