MySQL 8.0.31
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_from_interval (uint64_t low, uint64_t high)
 Generates a 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=detail::fast_hash_coeff_a1_64bit)
 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)
 
constexpr uint64_t ut::detail::hash_uint64_pair_fast (uint64_t n1, uint64_t n2)
 Calculates 64bit hash from two 64bit inputs. More...
 

Variables

constexpr uint64_t ut::detail::fast_hash_coeff_a1_64bit = 0xacb1f3526e25dd39
 
constexpr uint64_t ut::detail::fast_hash_coeff_a2_64bit = 0xd65b9175b5247ba3
 
constexpr uint64_t ut::detail::fast_hash_coeff_b_64bit = 0xf72a876a516b4b56
 
thread_local uint64_t ut::detail::random_seed = 0
 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