MySQL 9.0.0
Source Code Documentation
ut0rnd.h File Reference

Random numbers and hashing. More...

#include <atomic>
#include <cstdint>
#include "univ.i"
#include "ut0byte.h"
#include "ut0math.h"
#include "ut0class_life_cycle.h"
#include "ut0crc32.h"
#include "ut0seq_lock.h"

Go to the source code of this file.

Namespaces

namespace  ut
 This file contains a set of libraries providing overloads for regular dynamic allocation routines which allow for opt-in memory instrumentation through performance schema memory engine (PFS).
 
namespace  ut::detail
 

Functions

static uint64_t ut::random_64 ()
 The following function generates pseudo-random 64bit integers which enumerate the value space generated by a linear congruence. More...
 
static uint64_t ut::random_64_fast ()
 The following function returns fine clock count as random value. More...
 
static uint64_t ut::random_from_interval (uint64_t low, uint64_t high)
 Generates a pseudo-random integer from a given interval. More...
 
static uint64_t ut::random_from_interval_fast (uint64_t low, uint64_t high)
 Generates a light-weight pseudo-random integer from a given interval. More...
 
static uint64_t ut::hash_uint64 (uint64_t value)
 Hashes a 64-bit integer. More...
 
static uint64_t ut::hash_string (const char *str)
 Hashes a character string ending in the null character. More...
 
static uint64_t ut::hash_uint64_pair (uint64_t n1, uint64_t n2)
 Hashes a pair of 64bit integers. More...
 
static uint64_t ut::hash_binary (const byte *buf, size_t len, uint64_t seed=0xacb1f3526e25dd39)
 Hashes a binary buffer of given length. More...
 
static uint32_t ut::hash_binary_ib (const byte *str, size_t len)
 Hashes a binary buffer of given length in the old innobase way. More...
 
constexpr uint32_t ut::detail::hash_uint32_pair_ib (uint32_t n1, uint32_t n2)
 A helper method, it is used by hash_binary_ib for backward compatibility. More...
 
static int64_t ut::detail::read_from_1 (const byte *addr)
 
static int64_t ut::detail::read_from_2 (const byte *addr)
 
static int64_t ut::detail::read_from_4 (const byte *addr)
 
static int64_t ut::detail::read_from_8 (const byte *addr)
 
template<uint64_t random_64_func>
static uint64_t ut::random_from_interval_gen (uint64_t low, uint64_t high)
 

Variables

thread_local uint64_t ut::detail::random_seed = ut::this_thread_hash + my_timer_cycles()
 Seed value of ut::random_64() More...
 
std::array< std::array< uint64_t, 8 >, 256 > ut::detail::tab_hash_lookup_table
 Table for Tabulation Hashing, precomputed hash values for all byte values. More...
 

Detailed Description

Random numbers and hashing.

Created 1/20/1994 Heikki Tuuri