1/*
2* $Id: rnd.h,v 1.4 2006/08/01 04:13:17 jms Exp $
3*
4* Revision History
5* ===================
6* $Log: rnd.h,v $
7* Revision 1.4 2006/08/01 04:13:17 jms
8* fix parallel generation
9*
10* Revision 1.3 2006/07/31 17:23:09 jms
11* fix to parallelism problem
12*
13* Revision 1.2 2005/01/03 20:08:59 jms
14* change line terminations
15*
16* Revision 1.1.1.1 2004/11/24 23:31:47 jms
17* re-establish external server
18*
19* Revision 1.1.1.1 2003/08/08 21:50:34 jms
20* recreation after CVS crash
21*
22* Revision 1.3 2003/08/08 21:35:26 jms
23* first integration of rng64 for o_custkey and l_partkey
24*
25* Revision 1.2 2003/08/07 17:58:34 jms
26* Convery RNG to 64bit space as preparation for new large scale RNG
27*
28* Revision 1.1.1.1 2003/04/03 18:54:21 jms
29* initial checkin
30*
31*
32*/
33/*
34 * rnd.h -- header file for use withthe portable random number generator
35 * provided by Frank Stephens of Unisys
36 */
37
38/* function protypes */
39DSS_HUGE NextRand PROTO((DSS_HUGE));
40DSS_HUGE UnifInt PROTO((DSS_HUGE, DSS_HUGE, long));
41
42static long nA = 16807; /* the multiplier */
43static long nM = 2147483647;/* the modulus == 2^31 - 1 */
44static long nQ = 127773; /* the quotient nM / nA */
45static long nR = 2836; /* the remainder nM % nA */
46
47double dM = 2147483647.0;
48
49/*
50 * macros to control RNG and assure reproducible multi-stream
51 * runs without the need for seed files. Keep track of invocations of RNG
52 * and always round-up to a known per-row boundary.
53 */
54/*
55 * preferred solution, but not initializing correctly
56 */
57#define VSTR_MAX(len) (long)(len / 5 + (len % 5 == 0)?0:1 + 1)
58seed_t Seed[MAX_STREAM + 1] =
59{
60 {PART, 1, 0, 1}, /* P_MFG_SD 0 */
61 {PART, 46831694, 0, 1}, /* P_BRND_SD 1 */
62 {PART, 1841581359, 0, 1}, /* P_TYPE_SD 2 */
63 {PART, 1193163244, 0, 1}, /* P_SIZE_SD 3 */
64 {PART, 727633698, 0, 1}, /* P_CNTR_SD 4 */
65 {NONE, 933588178, 0, 1}, /* text pregeneration 5 */
66 {PART, 804159733, 0, 2}, /* P_CMNT_SD 6 */
67 {PSUPP, 1671059989, 0, SUPP_PER_PART}, /* PS_QTY_SD 7 */
68 {PSUPP, 1051288424, 0, SUPP_PER_PART}, /* PS_SCST_SD 8 */
69 {PSUPP, 1961692154, 0, SUPP_PER_PART * 2}, /* PS_CMNT_SD 9 */
70 {ORDER, 1227283347, 0, 1}, /* O_SUPP_SD 10 */
71 {ORDER, 1171034773, 0, 1}, /* O_CLRK_SD 11 */
72 {ORDER, 276090261, 0, 2}, /* O_CMNT_SD 12 */
73 {ORDER, 1066728069, 0, 1}, /* O_ODATE_SD 13 */
74 {LINE, 209208115, 0, O_LCNT_MAX}, /* L_QTY_SD 14 */
75 {LINE, 554590007, 0, O_LCNT_MAX}, /* L_DCNT_SD 15 */
76 {LINE, 721958466, 0, O_LCNT_MAX}, /* L_TAX_SD 16 */
77 {LINE, 1371272478, 0, O_LCNT_MAX}, /* L_SHIP_SD 17 */
78 {LINE, 675466456, 0, O_LCNT_MAX}, /* L_SMODE_SD 18 */
79 {LINE, 1808217256, 0, O_LCNT_MAX}, /* L_PKEY_SD 19 */
80 {LINE, 2095021727, 0, O_LCNT_MAX}, /* L_SKEY_SD 20 */
81 {LINE, 1769349045, 0, O_LCNT_MAX}, /* L_SDTE_SD 21 */
82 {LINE, 904914315, 0, O_LCNT_MAX}, /* L_CDTE_SD 22 */
83 {LINE, 373135028, 0, O_LCNT_MAX}, /* L_RDTE_SD 23 */
84 {LINE, 717419739, 0, O_LCNT_MAX}, /* L_RFLG_SD 24 */
85 {LINE, 1095462486, 0, O_LCNT_MAX * 2}, /* L_CMNT_SD 25 */
86 {CUST, 881155353, 0, 9}, /* C_ADDR_SD 26 */
87 {CUST, 1489529863, 0, 1}, /* C_NTRG_SD 27 */
88 {CUST, 1521138112, 0, 3}, /* C_PHNE_SD 28 */
89 {CUST, 298370230, 0, 1}, /* C_ABAL_SD 29 */
90 {CUST, 1140279430, 0, 1}, /* C_MSEG_SD 30 */
91 {CUST, 1335826707, 0, 2}, /* C_CMNT_SD 31 */
92 {SUPP, 706178559, 0, 9}, /* S_ADDR_SD 32 */
93 {SUPP, 110356601, 0, 1}, /* S_NTRG_SD 33 */
94 {SUPP, 884434366, 0, 3}, /* S_PHNE_SD 34 */
95 {SUPP, 962338209, 0, 1}, /* S_ABAL_SD 35 */
96 {SUPP, 1341315363, 0, 2}, /* S_CMNT_SD 36 */
97 {PART, 709314158, 0, 92}, /* P_NAME_SD 37 */
98 {ORDER, 591449447, 0, 1}, /* O_PRIO_SD 38 */
99 {LINE, 431918286, 0, 1}, /* HVAR_SD 39 */
100 {ORDER, 851767375, 0, 1}, /* O_CKEY_SD 40 */
101 {NATION, 606179079, 0, 2}, /* N_CMNT_SD 41 */
102 {REGION, 1500869201, 0, 2}, /* R_CMNT_SD 42 */
103 {ORDER, 1434868289, 0, 1}, /* O_LCNT_SD 43 */
104 {SUPP, 263032577, 0, 1}, /* BBB offset 44 */
105 {SUPP, 753643799, 0, 1}, /* BBB type 45 */
106 {SUPP, 202794285, 0, 1}, /* BBB comment 46 */
107 {SUPP, 715851524, 0, 1} /* BBB junk 47 */
108};
109