diff options
Diffstat (limited to 'src/lib/libc/stdlib/rand.3')
-rw-r--r-- | src/lib/libc/stdlib/rand.3 | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/lib/libc/stdlib/rand.3 b/src/lib/libc/stdlib/rand.3 index a0e7740e66..8899c2e104 100644 --- a/src/lib/libc/stdlib/rand.3 +++ b/src/lib/libc/stdlib/rand.3 | |||
@@ -33,8 +33,7 @@ | |||
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" from: @(#)rand.3 6.7 (Berkeley) 6/29/91 | 36 | .\" $OpenBSD: rand.3,v 1.8 2001/05/13 23:38:02 millert Exp $ |
37 | .\" $Id: rand.3,v 1.1.1.1 1995/10/18 08:42:19 deraadt Exp $ | ||
38 | .\" | 37 | .\" |
39 | .Dd June 29, 1991 | 38 | .Dd June 29, 1991 |
40 | .Dt RAND 3 | 39 | .Dt RAND 3 |
@@ -46,12 +45,15 @@ | |||
46 | .Sh SYNOPSIS | 45 | .Sh SYNOPSIS |
47 | .Fd #include <stdlib.h> | 46 | .Fd #include <stdlib.h> |
48 | .Ft void | 47 | .Ft void |
49 | .Fn srand "unsigned seed" | 48 | .Fn srand "unsigned int seed" |
50 | .Ft int | 49 | .Ft int |
51 | .Fn rand void | 50 | .Fn rand void |
51 | .Ft int | ||
52 | .Fn rand_r "unsigned int *seed" | ||
52 | .Sh DESCRIPTION | 53 | .Sh DESCRIPTION |
53 | .Bf -symbolic | 54 | .Bf -symbolic |
54 | These interfaces are obsoleted by random(3). | 55 | These interfaces are obsoleted by |
56 | .Xr random 3 . | ||
55 | .Ef | 57 | .Ef |
56 | .Pp | 58 | .Pp |
57 | The | 59 | The |
@@ -73,13 +75,28 @@ with the same seed value. | |||
73 | .Pp | 75 | .Pp |
74 | If no seed value is provided, the functions are automatically | 76 | If no seed value is provided, the functions are automatically |
75 | seeded with a value of 1. | 77 | seeded with a value of 1. |
78 | .Pp | ||
79 | The | ||
80 | .Fn rand_r | ||
81 | is a thread-safe version of | ||
82 | .Fn rand . | ||
83 | Storage for the seed must be provided through the | ||
84 | .Fa seed | ||
85 | argument, and needs to have been initialized by the caller. | ||
76 | .Sh SEE ALSO | 86 | .Sh SEE ALSO |
87 | .Xr arc4random 3 , | ||
88 | .Xr rand48 3 , | ||
77 | .Xr random 3 | 89 | .Xr random 3 |
78 | .Sh STANDARDS | 90 | .Sh STANDARDS |
79 | The | 91 | The |
80 | .Fn rand | 92 | .Fn rand |
81 | and | 93 | and |
82 | .Fn srand | 94 | .Fn srand |
83 | functions | 95 | functions conform to |
84 | conform to | ||
85 | .St -ansiC . | 96 | .St -ansiC . |
97 | .Pp | ||
98 | The | ||
99 | .Fn rand_r | ||
100 | function conforms to ISO/IEC 9945-1 ANSI/IEEE | ||
101 | .Pq Dq Tn POSIX | ||
102 | Std 1003.1c Draft 10. | ||