![]() |
Country Generator 1.0.1
Procedural country generation for C++23
|
Requires C++23 (e.g.,
-std=c++23for GCC/Clang,/std:c++latestfor MSVC).
API Reference · Usage Guide · Releases
get_country("Europe").get_country(seed) for reproducible results, generator-level seed() / unseed() for deterministic sequences, and country::seed() for replaying a previous generation.weighted(false) — every country has the same chance regardless of population.cntg instances with their own data and random engine — ideal for embedding inside other generators.countrygen.hpp is the single required file released here. You also need random.hpp in the same directory. Add
to the files you want to generate countries and set the necessary switches to enable C++23 (e.g., -std=c++23 for GCC and Clang).
Additionally you must supply the country generator with the resources folder containing full/countries.tsv and/or lite/countries.tsv, also available in the release.
For the complete feature guide — fields, filtering, weighting, and more — see the Usage Guide.
The country data is aggregated from multiple open-data sources:
| Source | License | Contribution |
|---|---|---|
| mledoze/countries | ODbL v1.0 | Names, ISO codes, borders, demonyms, languages, currencies |
| REST Countries | Open Source | Population, timezones, driving side, continents |
| World Bank | CC BY 4.0 | Income level classification |
See LICENSE_DATA.txt for details.
To regenerate datasets:
| Library | Description |
|---|---|
| name-generator | Culturally appropriate full names |
| nickname-generator | Gamer-style nicknames |
| birth-generator | Demographically plausible birthdays |
| biodata-generator | Procedural human physical characteristics |
| city-generator | Weighted city selection by population |
| entity-generator | ECS-based entity generation |