#include <algorithm>
#include <array>
#include <list>
#include <map>
#include <iostream>
#include <random>
#include <set>
#include <vector>
template <typename T>
T random_integer(T min, T max)
{
static thread_local std::random_device rd;
static thread_local std::default_random_engine eng(rd());
std::uniform_int_distribution<T> dist(min, max);
return dist(eng);
}
struct cell {
using cell_type = std::pair<char, int>;
constexpr cell() = default;
char& get_char()
{
return c.first;
}
char get_char() const
{
return c.first;
}
int& get_int()
{
return c.second;
}
int get_int() const
{
return c.second;
}
bool char_set() const
{
return get_char() != '\0';
}
bool int_set() const
{
return get_int() != -1;
}
friend std::ostream& operator<<(std::ostream& os, const cell& c) {
os << c.get_int() << c.get_char();
return os;
}
cell_type c{'\0', -1};
};
template <typename T>
void remove(std::vector<T>& v, std::size_t i)
{
std::swap(v[i], v.back());
v.pop_back();
}
struct row {
using cell_type = cell;
static constexpr auto row_size = 10;
using row_type = std::array<cell, row_size>;
constexpr row() = default;
void generate()
{
std::vector<char> available_chars(row_size);
std::iota(available_chars.begin(), available_chars.end(), 'A');
std::vector<int> available_ints(row_size);
std::iota(available_ints.begin(), available_ints.end(), 0);
for (auto i = 0; i < row_size; ++i) {
{
auto rand = random_integer<int>(0, available_ints.size());
r[i].get_int() = available_ints[rand];
remove(available_ints, rand);
/* available_ints.erase(n_begin); */
}
{
auto rand = random_integer<int>(0, available_chars.size());
r[i].get_char() = available_chars[rand];
remove(available_chars, rand);
}
}
}
row_type r{};
};
struct table {
using row_type = row;
using cell_type = typename row_type::cell_type;
using table_type = std::array<row_type, 10>;
constexpr table() = default;
void generate()
{
/* for (auto& r : t) { */
/* r.generate(); */
/* } */
for(auto i = 0; i < row_type::row_size; ++i)
{
for(auto c = 0; c < row_type::row_size; ++c)
{
auto& ref = t[i * row_type::row_size + c];
ref.get_char() = c + 'A';
ref.get_int() = i;
}
}
}
void reorder() {
}
/* void set_column(std::size_t col, row_type data) */
/* { */
/* for (auto i = 0; i < row_type::row_size; ++i) { */
/* t[i].r[col] = data.r[i]; */
/* } */
/* } */
friend std::ostream& operator<<(std::ostream& os, const table& t) {
for(auto i = 0; i < t.t.size(); ++i)
{
os << t.t[i];
if(i != 0 && (i + 1) % 10 == 0) {
os << '\n';
} else {
os << ' ';
}
}
return os;
}
table_type t{};
};
int main()
{
table t;
t.generate();
std::cout << t;
return 0;
}