20#ifndef ORES_SYNTHETIC_DOMAIN_GENERATION_CONTEXT_HPP
21#define ORES_SYNTHETIC_DOMAIN_GENERATION_CONTEXT_HPP
29#include <boost/uuid/uuid.hpp>
31namespace ores::synthetic::domain {
57 std::uint64_t
seed()
const {
return seed_; }
73 const T&
pick(
const std::vector<T>& items) {
75 throw std::out_of_range(
"Cannot pick from an empty vector.");
77 std::uniform_int_distribution<std::size_t> dist(0, items.size() - 1);
78 return items[dist(engine_)];
84 template<
typename T, std::
size_t N>
85 const T&
pick(
const std::array<T, N>& items) {
86 static_assert(N > 0,
"Cannot pick from an empty array.");
87 std::uniform_int_distribution<std::size_t> dist(0, N - 1);
88 return items[dist(engine_)];
99 std::chrono::system_clock::time_point
past_timepoint(
int years_back = 3);
108 std::mt19937_64 engine_;
Context for controlling synthetic data generation.
Definition generation_context.hpp:40
std::string alphanumeric(std::size_t length)
Generates an alphanumeric string of specified length.
Definition generation_context.cpp:80
const T & pick(const std::array< T, N > &items)
Picks a random element from an array.
Definition generation_context.hpp:85
generation_context()
Constructs a generation context with a random seed.
Definition generation_context.cpp:27
bool random_bool(double probability=0.5)
Generates a random boolean with specified probability of true.
Definition generation_context.cpp:35
std::uint64_t seed() const
Returns the seed used for this context.
Definition generation_context.hpp:57
std::chrono::system_clock::time_point past_timepoint(int years_back=3)
Generates a random timestamp within the past N years.
Definition generation_context.cpp:74
const T & pick(const std::vector< T > &items)
Picks a random element from a vector.
Definition generation_context.hpp:73
int random_int(int min, int max)
Generates a random integer in the specified range.
Definition generation_context.cpp:30
boost::uuids::uuid generate_uuid()
Generates a UUID v7 based on the context's random state.
Definition generation_context.cpp:40