Cachemere
Modular Caching Library for C++
include
cachemere
policy
detail
hash_mixer.h
1
#ifndef CACHEMERE_HASHMIXER_H
2
#define CACHEMERE_HASHMIXER_H
3
4
#include <cstdint>
5
#include <random>
6
7
namespace
cachemere::policy::detail {
8
13
template
<
typename
Key,
typename
KeyHash>
class
HashMixer
:
private
KeyHash
14
{
15
public
:
20
HashMixer
(
const
Key& key,
size_t
value_range);
21
24
[[nodiscard]]
size_t
operator()
();
25
26
private
:
27
std::minstd_rand m_rng;
28
size_t
m_value_range;
29
};
30
31
}
// namespace cachemere::policy::detail
32
33
#include "hash_mixer.hpp"
34
35
#endif
cachemere::policy::detail::HashMixer
Functor used for generating a uniform sequence of numbers in a given value range for a given key.
Definition:
hash_mixer.h:13
cachemere::policy::detail::HashMixer::HashMixer
HashMixer(const Key &key, size_t value_range)
Constructor.
Definition:
hash_mixer.hpp:4
cachemere::policy::detail::HashMixer::operator()
size_t operator()()
Generate the next value in the random sequence.
Definition:
hash_mixer.hpp:11
Generated by
1.8.17