1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#ifndef RANDOM_HH
#define RANDOM_HH
#include <array>
#include <cstddef>
#include <random>
#include <string>
#include <string_view>
#include <vector>
#include "book.hh"
#include "person.hh"
namespace book_store::utility::random {
constexpr std::array<std::string_view, 50> names = {
"James", "John", "Robert", "Michael", "William", "David",
"Richard", "Joseph", "Thomas", "Charles", "Daniel", "Matthew",
"Anthony", "Donald", "Mark", "Paul", "Steven", "Andrew",
"Kenneth", "Joshua", "George", "Kevin", "Brian", "Edward",
"Ronald", "Timothy", "Jason", "Jeffrey", "Ryan", "Jacob",
"Gary", "Nicholas", "Eric", "Stephen", "Jonathan", "Larry",
"Justin", "Scott", "Brandon", "Frank", "Benjamin", "Gregory",
"Samuel", "Raymond", "Patrick", "Alexander", "Jack", "Dennis",
"Jerry", "Tyler"};
constexpr std::array<std::string_view, 50> book_title_parts = {
"The", "A", "An", "In", "Of", "And",
"To", "For", "With", "On", "At", "By",
"From", "Up", "About", "Into", "Over", "After",
"Between", "Out", "Against", "Under", "Without", "Within",
"Along", "Across", "Behind", "Beyond", "Through", "Around",
"Among", "Upon", "Beside", "Toward", "Against", "Upon",
"Amongst", "Between", "Within", "Without", "Underneath", "Under",
"Over", "Into", "About", "Up", "From", "By",
"At", "On"};
constexpr std::array<std::string_view, 10> publishers = {
"Penguin", "Random House", "HarperCollins", "Simon & Schuster",
"Macmillan", "Hachette", "Harlequin", "Scholastic",
"Pearson", "Houghton Mifflin"};
class book_random_engine {
private:
std::mt19937 _random_number_generator;
public:
book_random_engine() : _random_number_generator(std::random_device{}()) {}
explicit book_random_engine(std::mt19937 random_number_generator)
: _random_number_generator(random_number_generator) {}
book_random_engine(const book_random_engine &) = default;
book_random_engine(book_random_engine &&) = default;
auto title() -> std::string;
auto name() -> std::string;
auto author() -> consumer::person;
auto authors() -> std::vector<consumer::person>;
auto publisher() -> std::string;
auto isbn() -> std::string;
auto price_usd() -> double;
auto copy_count() -> product::book::size_type;
auto id() -> std::size_t;
auto operator=(const book_random_engine &) -> book_random_engine & = default;
auto operator=(book_random_engine &&) -> book_random_engine & = default;
};
} // namespace book_store::utility::random
#endif // RANDOM_HH
|