InnoDB Plugin  1.0
Macros | Functions | Variables
ut0rnd.ic File Reference
This graph shows which files directly or indirectly include this file:

Macros

#define UT_HASH_RANDOM_MASK   1463735687
#define UT_HASH_RANDOM_MASK2   1653893711
#define UT_RND1   151117737
#define UT_RND2   119785373
#define UT_RND3   85689495
#define UT_RND4   76595339
#define UT_SUM_RND2   98781234
#define UT_SUM_RND3   126792457
#define UT_SUM_RND4   63498502
#define UT_XOR_RND1   187678878
#define UT_XOR_RND2   143537923

Functions

UNIV_INLINE void ut_rnd_set_seed (ulint seed)
UNIV_INLINE ulint ut_rnd_gen_next_ulint (ulint rnd)
UNIV_INLINE ulint ut_rnd_gen_ulint (void)
UNIV_INLINE ulint ut_rnd_interval (ulint low, ulint high)
UNIV_INLINE ibool ut_rnd_gen_ibool (void)
UNIV_INLINE ulint ut_hash_ulint (ulint key, ulint table_size)
UNIV_INLINE ulint ut_fold_ull (ib_uint64_t d)
UNIV_INLINE ulint ut_fold_string (const char *str)
UNIV_INLINE ulint ut_fold_ulint_pair (ulint n1, ulint n2)
UNIV_INLINE ulint ut_fold_binary (const byte *str, ulint len)

Variables

ulint ut_rnd_ulint_counter

Detailed Description

Random numbers and hashing

Created 5/30/1994 Heikki Tuuri

Function Documentation

UNIV_INLINE ulint ut_fold_binary ( const byte *  str,
ulint  len 
)

Folds a binary string.

Returns
folded value
Parameters
strin: string of bytes
lenin: length
UNIV_INLINE ulint ut_fold_string ( const char *  str)

Folds a character string ending in the null character.

Returns
folded value
Parameters
strin: null-terminated string
UNIV_INLINE ulint ut_fold_ulint_pair ( ulint  n1,
ulint  n2 
)

Folds a pair of ulints.

Returns
folded value
Parameters
n1in: ulint
n2in: ulint
UNIV_INLINE ulint ut_fold_ull ( ib_uint64_t  d)

Folds a 64-bit integer.

Returns
folded value
Parameters
din: 64-bit integer
UNIV_INLINE ulint ut_hash_ulint ( ulint  key,
ulint  table_size 
)

The following function generates a hash value for a ulint integer to a hash table of size table_size, which should be a prime or some random number for the hash table to work reliably.

Returns
hash value
Parameters
keyin: value to be hashed
table_sizein: hash table size
UNIV_INLINE ibool ut_rnd_gen_ibool ( void  )

Generates a random iboolean value.

Returns
the random value
UNIV_INLINE ulint ut_rnd_gen_next_ulint ( ulint  rnd)

The following function generates a series of 'random' ulint integers.

Returns
the next 'random' number
Parameters
rndin: the previous random number value
UNIV_INLINE ulint ut_rnd_gen_ulint ( void  )

The following function generates 'random' ulint integers which enumerate the value space of ulint integers in a pseudo random fashion. Note that the same integer is repeated always after 2 to power 32 calls to the generator (if ulint is 32-bit).

Returns
the 'random' number
UNIV_INLINE ulint ut_rnd_interval ( ulint  low,
ulint  high 
)

Generates a random integer from a given interval.

Returns
the 'random' number
Parameters
lowin: low limit; can generate also this value
highin: high limit; can generate also this value
UNIV_INLINE void ut_rnd_set_seed ( ulint  seed)

This is used to set the random number seed.

Parameters
seedin: seed

Variable Documentation

ulint ut_rnd_ulint_counter

Seed value of ut_rnd_gen_ulint()