制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗Requires C++23 (e.g.,
-std=c++23for GCC/Clang,/std:c++latestfor MSVC).
API Reference · Usage Guide · Data and Method · Releases
Email addresses in each country's style, for tests, fixtures and generated users. The local part follows the country's naming habits from a given name, family name, nickname and birth year, and the domain is a provider people use there. A safe option uses the reserved example.* domains.
Locale-matched Local Parts. ana.souza, a.souza85, souza_ana, handles: nine style profiles weight the shapes by country. Names are folded to ASCII (Ørsted is orsted) and particles skipped (da Silva is silva).
Provider Domains by Country. Global webmail plus the providers of the country (web.de, uol.com.br, qq.com, ...), by weight.
Safe for Tests. safe gives example.com, example.net or example.org (RFC 2606), so a message sent to the address reaches nobody.
Deterministic Seeding. Per-call get_email(request, seed) for reproducible results, and seed() on the result for replaying a previous generation with the same request and data.
Batch Generation. Generate thousands of results from one seed, on several threads with the same output for any thread count, optionally unique by a key, and stream them as JSON Lines or CSV (see the usage guide).
Identical Everywhere. A seed gives the same result on every compiler, standard library and CPU (GCC, Clang, MSVC, Emscripten; x86-64 and ARM64), checked by known-answer tests.
Extensible Data. Load your own TSV layers on top of the shipped data to add, change or remove entries (extend()), checked before they are applied.
JSON and Replay. to_json() on every result, and a signature() recording the seed and the data it came from.
Compiled-in Data. Define DASMIG_EMAIL_EMBED to build the lite tier into the program, for WebAssembly and other builds without files.
Multi-Instance Support. Construct independent emg instances with their own data and random engine.
emailgen.hpp is the library released here. Keep core.hpp and the core/ directory (dasmig-core) in the same directory. Add
#include <dasmig/emailgen.hpp>
to the files you want to use it in, and supply the resources folder (or define DASMIG_EMAIL_EMBED).
#include <dasmig/emailgen.hpp>
#include <iostream>
auto& gen = dasmig::emg::instance(); // loads the lite tier
// The names are plain values; the country sets the style and the domain.
auto e = gen.get_email({.country = "DE", .given = "Zoë", .family = "Müller", .birth_year = 1988});
std::cout << e << '\n'; // [email protected]
std::cout << e.kind << '\n'; // free
// No names: a handle in the country's style.
std::cout << gen.get_email({.country = "JP"}) << '\n';
// An address that reaches nobody, for tests.
std::cout << gen.get_email({.given = "Sam", .family = "Lee", .safe = true}) << '\n'; // [email protected]
// The same seed gives the same result everywhere.
auto again = gen.get_email({.country = "DE", .given = "Zoë", .family = "Müller", .birth_year = 1988}, e.seed());
See the usage guide for everything else.
make # example
make test # tests
make bench # benchmarks, results in build/bench.tsv
make test-embed # tests with the lite tier compiled in
make coverage # code coverage
make lint # clang-tidy
make docs # API docs
make embed # regenerate dasmig/emailgen_data.hpp from resources/lite
Tested with:
-std=c++23)-std=c++23)/std:c++latest)| Dependency | Version | Bundled | Purpose |
|---|---|---|---|
| dasmig-core | 1.4 | Yes (core.hpp, core/) | Platform-independent random engine and distributions, data layers, JSON |
| Catch2 | 3.x | Yes (amalgamated) | Unit testing |
| Library | Description |
|---|---|
| address-generator | Postal addresses with real streets by place |
| biodata-generator | Procedural human physical characteristics |
| birth-generator | Demographically plausible birthdays |
| city-generator | Weighted city selection by population |
| country-generator | Weighted country selection by population |
| device-generator | Devices, browsers, user agents and IP addresses that fit together |
| entity-generator | ECS-based entity generation |
| interest-generator | Religion, hobbies and favourite media by country, age and sex |
| name-generator | Culturally appropriate full names |
| nickname-generator | Gamer-style nicknames |
| occupation-generator | Employment status, education and occupation by country, age and sex |
| persona-generator |
This library is released under the MIT License.
MIT License
Copyright (c) 2026 Diego Dasso Migotto
| Complete characters composed from the other generators |
| phone-generator | Phone numbers valid in each country's numbering plan |
| relationship-generator | Families around a person: parents, siblings, partners and children |
| trait-generator | Personality traits with conflicts, synergies and Big Five axes |
| user-generator | Complete user records: account, username, email, phone and address |