Random number generators.
Definition in file rand.hpp.
Go to the source code of this file.
#include <algorithm>#include <cstdint>#include <limits>#include <random>#include <utility>#include <userver/compiler/thread_local.hpp>#include <userver/utils/assert.hpp>
Include dependency graph for rand.hpp:
This graph shows which files directly or indirectly include this file:Classes | |
| class | utils::RandomBase |
| Virtualized standard UniformRandomBitGenerator concept, for use with random number distributions. More... | |
Namespaces | |
| namespace | utils |
| Utilities. | |
Functions | |
| template<typename Func > | |
| decltype(auto) | utils::WithDefaultRandom (Func &&func) |
| Calls func with a thread-local UniformRandomBitGenerator (specifically of type utils::RandomBase). | |
| template<typename T > | |
| T | utils::RandRange (T from_inclusive, T to_exclusive) |
| Generates a random number in range [from, to) | |
| template<typename T > | |
| T | utils::RandRange (T to_exclusive) |
| Generates a random number in range [0, to) | |
| template<typename Container > | |
| void | utils::Shuffle (Container &container) |
| Shuffles the elements within the container. | |
| std::uint32_t | utils::Rand () |
Generate a random number in the whole uint32_t range. | |