diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 1997-03-23 23:08:31 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 1997-03-23 23:08:31 +0000 |
| commit | 7b0b1b2f297df77483aef2b2f44e416714b88b93 (patch) | |
| tree | 8c576b525afc61f7f2392f7462155b87acaf4be3 /lib/libc/stdlib | |
| parent | 767b268b5db6aa09189a724e244acd1007ddda84 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdlib')
| -rw-r--r-- | lib/libc/stdlib/random.3 | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/libc/stdlib/random.3 b/lib/libc/stdlib/random.3 index fed15b44820e..bced4aa9b52d 100644 --- a/lib/libc/stdlib/random.3 +++ b/lib/libc/stdlib/random.3 @@ -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 |
