diff options
| author | Tom Rhodes <trhodes@FreeBSD.org> | 2003-05-01 19:09:16 +0000 |
|---|---|---|
| committer | Tom Rhodes <trhodes@FreeBSD.org> | 2003-05-01 19:09:16 +0000 |
| commit | 7b98ad3005943cb00f566909c5460e3738566b54 (patch) | |
| tree | 6605d6d9726e7a754c4f6ac88b4bce7a43766a4a /lib/libc | |
| parent | d05090827f0e5b95cc7d2bcdde8b3b4e0f986241 (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/gen/arc4random.3 | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/libc/gen/arc4random.3 b/lib/libc/gen/arc4random.3 index dba6921f39fb..4af1472fdd3d 100644 --- a/lib/libc/gen/arc4random.3 +++ b/lib/libc/gen/arc4random.3 @@ -57,7 +57,13 @@ The S-Boxes can be in about .if t 2\u\s71700\s10\d .if n (2**1700) -states. +states. The +.Fn arc4random +function returns pseudo-random numbers in the range of 0 to +.if t 2\u\s731\s10\d\(mi1, +.if n (2**31)\(mi1, +and therefore has twice the range of +.Dv RAND_MAX . .Pp The .Fn arc4random_stir @@ -73,6 +79,15 @@ before using since .Fn arc4random automatically initializes itself. +.Sh EXAMPLES +The following produces a drop-in replacement for the traditional +.Fn rand +and +.Fn random +functions using +.Fn arc4random : +.Pp +.Dv #define Fn foo4random ( Fn arc4random Ft % ((unsigned)RAND_MAX + 1)) .Sh SEE ALSO .Xr rand 3 , .Xr random 3 , |
