1
/**********************************************************************
2
Random numbers and hashing
4
(c) 1994, 1995 Innobase Oy
6
Created 1/20/1994 Heikki Tuuri
7
***********************************************************************/
16
/* The 'character code' for end of field or string (used
18
#define UT_END_OF_FIELD 257
20
/************************************************************
21
This is used to set the random number seed. */
26
ulint seed); /* in: seed */
27
/************************************************************
28
The following function generates a series of 'random' ulint integers. */
31
ut_rnd_gen_next_ulint(
32
/*==================*/
33
/* out: the next 'random' number */
34
ulint rnd); /* in: the previous random number value */
35
/*************************************************************
36
The following function generates 'random' ulint integers which
37
enumerate the value space (let there be N of them) of ulint integers
38
in a pseudo-random fashion. Note that the same integer is repeated
39
always after N calls to the generator. */
42
ut_rnd_gen_ulint(void);
43
/*==================*/
44
/* out: the 'random' number */
45
/************************************************************
46
Generates a random integer from a given interval. */
51
/* out: the 'random' number */
52
ulint low, /* in: low limit; can generate also this value */
53
ulint high); /* in: high limit; can generate also this value */
54
/*************************************************************
55
Generates a random iboolean value. */
58
ut_rnd_gen_ibool(void);
60
/* out: the random value */
61
/***********************************************************
62
The following function generates a hash value for a ulint integer
63
to a hash table of size table_size, which should be a prime or some
64
random number to work reliably. */
70
ulint key, /* in: value to be hashed */
71
ulint table_size); /* in: hash table size */
72
/*****************************************************************
73
Folds a pair of ulints. */
78
/* out: folded value */
79
ulint n1, /* in: ulint */
80
ulint n2); /* in: ulint */
81
/*****************************************************************
87
/* out: folded value */
88
dulint d); /* in: dulint */
89
/*****************************************************************
90
Folds a character string ending in the null character. */
95
/* out: folded value */
96
const char* str); /* in: null-terminated string */
97
/*****************************************************************
98
Folds a binary string. */
103
/* out: folded value */
104
const byte* str, /* in: string of bytes */
105
ulint len); /* in: length */
106
/***************************************************************
107
Looks for a prime number slightly greater than the given argument.
108
The prime is chosen so that it is not near any power of 2. */
114
ulint n); /* in: positive number > 100 */