root / man / man3 / HPL_rand.3 @ 1
Historique | Voir | Annoter | Télécharger (1,05 ko)
1 | 1 | equemene | .TH HPL_rand 3 "September 10, 2008" "HPL 2.0" "HPL Library Functions" |
---|---|---|---|
2 | 1 | equemene | .SH NAME |
3 | 1 | equemene | HPL_rand \- random number generator. |
4 | 1 | equemene | .SH SYNOPSIS |
5 | 1 | equemene | \fB\&#include "hpl.h"\fR |
6 | 1 | equemene | |
7 | 1 | equemene | \fB\&double\fR |
8 | 1 | equemene | \fB\&HPL_rand();\fR |
9 | 1 | equemene | .SH DESCRIPTION |
10 | 1 | equemene | \fB\&HPL_rand\fR |
11 | 1 | equemene | generates the next number in the random sequence. This |
12 | 1 | equemene | function ensures that this number lies in the interval (-0.5, 0.5]. |
13 | 1 | equemene | |
14 | 1 | equemene | The static array irand contains the information (2 integers) required |
15 | 1 | equemene | to generate the next number in the sequence X(n). This number is |
16 | 1 | equemene | computed as X(n) = (2^16 * irand[1] + irand[0]) / d - 0.5, where the |
17 | 1 | equemene | constant d is the largest 32 bit positive integer. The array irand is |
18 | 1 | equemene | then updated for the generation of the next number X(n+1) in the |
19 | 1 | equemene | random sequence as follows X(n+1) = a * X(n) + c. The constants a and |
20 | 1 | equemene | c should have been preliminarily stored in the arrays ias and ics as |
21 | 1 | equemene | 2 pairs of integers. The initialization of ias, ics and irand is |
22 | 1 | equemene | performed by the function HPL_setran. |
23 | 1 | equemene | .SH SEE ALSO |
24 | 1 | equemene | .BR HPL_ladd \ (3), |
25 | 1 | equemene | .BR HPL_lmul \ (3), |
26 | 1 | equemene | .BR HPL_setran \ (3), |
27 | 1 | equemene | .BR HPL_xjumpm \ (3), |
28 | 1 | equemene | .BR HPL_jumpit \ (3). |