1 /* Copyright (c) 2003, 2005 MySQL AB
2    Use is subject to license terms
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; version 2 of the License.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 
13    You should have received a copy of the GNU General Public License
14    along with this program; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA */
16 
17 #ifndef RANDOM_H
18 #define RANDOM_H
19 
20 /***************************************************************
21 * I N C L U D E D   F I L E S                                  *
22 ***************************************************************/
23 
24 /***************************************************************
25 * M A C R O S                                                  *
26 ***************************************************************/
27 
28 /***************************************************************/
29 /* C O N S T A N T S                                           */
30 /***************************************************************/
31 
32 
33 /***************************************************************
34 * D A T A   S T R U C T U R E S                                *
35 ***************************************************************/
36 
37 typedef struct {
38    unsigned int  length;
39    unsigned int *values;
40    unsigned int  currentIndex;
41 }RandomSequence;
42 
43 typedef struct {
44    unsigned int length;
45    unsigned int value;
46 }SequenceValues;
47 
48 /***************************************************************
49 * P U B L I C    F U N C T I O N S                             *
50 ***************************************************************/
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 
57 extern double getTps(unsigned int count, double timeValue);
58 
59 /*----------------------------*/
60 /* Random Sequences Functions */
61 /*----------------------------*/
62 extern int  initSequence(RandomSequence *seq, SequenceValues *inputValues);
63 extern unsigned int getNextRandom(RandomSequence *seq);
64 extern void printSequence(RandomSequence *seq, unsigned int numPerRow);
65 
66 /*---------------------------------------------------*/
67 /* Code from the glibc, to make sure the same random */
68 /* number generator is used by all                   */
69 /*---------------------------------------------------*/
70 extern void myRandom48Init(long int seedval);
71 extern long int myRandom48(unsigned int maxValue);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 /***************************************************************
78 * E X T E R N A L   D A T A                                    *
79 ***************************************************************/
80 
81 
82 
83 #endif /* RANDOM_H */
84 
85