1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
|
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" References consulted:
.\" Linux libc source code
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\" 386BSD man pages
.\" Modified Sat Jul 24 19:46:03 1993 by Rik Faith (faith@cs.unc.edu)
.\"
.\" Japanese Version Copyright (c) 1997 YOSHINO Takashi
.\" all rights reserved.
.\" Translated Mon Jan 20 20:04:05 JST 1997
.\" by YOSHINO Takashi <yoshino@civil.jcn.nihon-u.ac.jp>
.\"
.\" WORD: internal buffer Хåե
.\"
.TH DRAND48 3 2007-07-26 "" "Linux Programmer's Manual"
.SH ̾
drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48,
lcong48 \- ʬۤ뵿ؿ
.SH
.nf
.B #include <stdlib.h>
.sp
.B double drand48(void);
.sp
.BI "double erand48(unsigned short " xsubi [3]);
.sp
.B long int lrand48(void);
.sp
.BI "long int nrand48(unsigned short " xsubi [3]);
.sp
.B long int mrand48(void);
.sp
.BI "long int jrand48(unsigned short " xsubi [3]);
.sp
.BI "void srand48(long int " seedval );
.sp
.BI "unsigned short *seed48(unsigned short " seed16v [3]);
.sp
.BI "void lcong48(unsigned short " param [7]);
.fi
.sp
.in -4n
glibc εǽޥ
.RB ( feature_test_macros (7)
):
.in
.sp
.ad l
嵭Ƥδؿ:
.\" .BR drand48 (),
.\" .BR erand48 (),
.\" .BR lrand48 (),
.\" .BR nrand48 (),
.\" .BR mrand48 (),
.\" .BR jrand48 (),
.\" .BR srand48 (),
.\" .BR seed48 (),
.\" .BR lcong48 ():
_SVID_SOURCE || _XOPEN_SOURCE
.ad b
.SH
δؿƱ르ꥺ 48ӥå黻Ѥ
롣
.PP
ؿ
.BR drand48 ()
.BR erand48 ()
ϡ [0.0, 1.0)
ʬۤư¿֤ͤ
.PP
ؿ
.BR lrand48 ()
.BR nrand48 ()
0 2^31 δ֤ǰʬۤ
Υ֤
.PP
ؿ
.BR mrand48 ()
.BR jrand48 ()
\-2^31 2^31 δ֤ǰʬۤդ֤
.PP
ؿ
.BR srand48 (),
.BR seed48 (),
.BR lcong48 ()
Ͻؿ
Ǥ롣
ؿ
.BR drand48 (),
.BR lrand48 (),
.BR mrand48 ()
ѤˡνؿΤ줫Ƥ֤٤Ǥ롣
ؿ
.BR erand48 (),
.BR nrand48 (),
.BR jrand48 ()
Ͻ
ؿƤ֤ȤɬפȤʤ
.PP
Ƥ뤹٤Ƥδؿ 48ӥåȤ
(\fIXi\fP) 뤳Ȥ
ǽƤ롣ˡϰʲƱμˤ롣
.sp
.nf
.RS
.B Xn+1 = (aXn + c) mod m,
.RE
.fi
.sp
n >= 0 Ǥ롣
ѥ \fIm\fP = 2^48 Ǥ뤿ᡢ48ӥå黻ԤƤ롣
.BR lcong48 ()
ƤФƤʤ硢\fIa\fP \fIc\fP ϰʲμͿ롣
.sp
.nf
.RS
.B a = 0x5DEECE66D
.B c = 0xB
.RE
.fi
.sp
ؿ
.BR drand48 (),
.BR erand48 (),
.BR lrand48 (),
.BR nrand48 (),
.BR mrand48 (),
.BR jrand48 ()
֤ͤϼΤ褦ˤƷ롣
Ϥˡ48ӥåȤ \fIXi\fP 롣
ơ֤٤ǡη˰¸Ŭڤ
ӥåȿ \fIXi\fP ξ̥ӥåȤ饳ԡ롣
Ǹˡ֤ͤͤѴ롣
.PP
ؿ
.BR drand48 (),
.BR lrand48 (),
.BR mrand48 ()
Ǹ줿48ӥåȤ \fIXi\fP Хåե˳Ǽ롣
ηΰ \fIxsubi\fP ˸ġ \fIXi\fP ͤ
ǼǤ褦ΰݤ뤳Ȥ
ؿ
.BR erand48 (),
.BR nrand48 (),
.BR jrand48 ()
ϡ
ƤӽФ¦Υץ᤹롣
δؿϡϤƤδؿƤ \fIXi\fP νͤ
뤳Ȥǽ롣
.PP
ؿ
.BR srand48 ()
ϡ\fIXi\fP
32ӥåȤ \fIseedval\fP ꤹ롣
̤16ӥåȤϡŬ˷줿ͤǤ0x330Eꤵ롣
.PP
ؿ
.BR seed48 ()
ϡ\fIXi\fP ͤ
ηǤ \fIseed16v\fP ǻꤵ줿 48ӥåȤͤꤹ롣
\fIXi\fP ͤХåե˥ԡ졢ΥХåեؤΥݥ
.BR seed48 ()
ˤä֤롣
.PP
ؿ
.BR lcong48 ()
ϻѼԤ \fIXi\fP, \fIa\fP, \fIc\fP
ͤꤹ뤿δؿǤ롣
ηǤϤ줾졢\fIparam[0-2]\fP \fIXi\fP
\fIparam[3-5]\fP \fIa\fP \fIparam[6]\fP \fIc\fP ꤹ
Ǥ롣
.BR lcong48 ()
ƤФ줿ǡ
.BR srand48 ()
.BR seed48 ()
Ƥ֤ȡҤ \fIa\fP \fIc\fP
ɸͤƤꤵ롣
.SH
SVr4, POSIX.1-2001.
.SH
SVID 3 ǤϤδؿϻ٤Ƥ롣
SVID 3 Ǥ
.BR rand (3)
˻Ѥ٤ȵҤƤ롣
.SH Ϣ
.BR rand (3),
.BR random (3)
|