~vlad-lesin/percona-server/mysql-5.0.33-original

« back to all changes in this revision

Viewing changes to ndb/include/util/random.h

  • Committer: Vlad Lesin
  • Date: 2012-07-31 09:21:34 UTC
  • Revision ID: vladislav.lesin@percona.com-20120731092134-zfodx022b7992wsi
VirginĀ 5.0.33

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; either version 2 of the License, or
 
6
   (at your option) any later version.
 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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