1/*
2 * Legal Notice
3 *
4 * This document and associated source code (the "Work") is a part of a
5 * benchmark specification maintained by the TPC.
6 *
7 * The TPC reserves all right, title, and interest to the Work as provided
8 * under U.S. and international laws, including without limitation all patent
9 * and trademark rights therein.
10 *
11 * No Warranty
12 *
13 * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
14 * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
15 * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
16 * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
17 * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
18 * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
19 * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
20 * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
21 * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
22 * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
23 * WITH REGARD TO THE WORK.
24 * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
25 * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
26 * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
27 * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
28 * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
29 * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
30 * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
31 * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
32 *
33 * Contributors:
34 * Gradient Systems
35 */
36#ifndef GENRAND_H
37#define GENRAND_H
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43#include "decimal.h"
44#include "date.h"
45#include "dist.h"
46#include "address.h"
47#define JMS 1
48
49typedef struct RNG_T {
50 int nUsed;
51 int nUsedPerRow;
52 long nSeed;
53 long nInitialSeed; /* used to allow skip_row() to back up */
54 int nColumn; /* column where this stream is used */
55 int nTable; /* table where this stream is used */
56 int nDuplicateOf; /* duplicate streams allow independent tables to share
57 data streams */
58#ifdef JMS
59 ds_key_t nTotal;
60#endif
61} rng_t;
62extern rng_t Streams[];
63
64#define FL_SEED_OVERRUN 0x0001
65
66#define ALPHANUM "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789"
67#define DIGITS "0123456789"
68
69#define RNG_SEED 19620718
70
71int genrand_integer(int *dest, int dist, int min, int max, int mean, int stream);
72int genrand_decimal(decimal_t *dest, int dist, decimal_t *min, decimal_t *max, decimal_t *mean, int stream);
73int genrand_date(date_t *dest, int dist, date_t *min, date_t *max, date_t *mean, int stream);
74ds_key_t genrand_key(ds_key_t *dest, int dist, ds_key_t min, ds_key_t max, ds_key_t mean, int stream);
75int gen_charset(char *dest, char *set, int min, int max, int stream);
76int dump_seeds_ds(int tbl);
77void init_rand(void);
78void skip_random(int s, ds_key_t count);
79int RNGReset(int nTable);
80long next_random(int nStream);
81void genrand_email(char *pEmail, char *pFirst, char *pLast, int nColumn);
82void genrand_ipaddr(char *pDest, int nColumn);
83int genrand_url(char *pDest, int nColumn);
84int setSeed(int nStream, int nValue);
85void resetSeeds(int nTable);
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif
92