![]() |
Nickname Generator 5.2.2
Gamer-style nickname generation for C++23
|
Requires C++23 (e.g.,
-std=c++23for GCC/Clang,/std:c++latestfor MSVC).
API Reference · Usage Guide · Releases
Gamer-style nicknames made from names or word lists.
The library currently supports the following:
style chooses a decorated gaming handle (xXNioiXx, the default) or a username (jose.garcia, jsmith92, swiftfox): lowercase ASCII, accents folded, at most 24 characters, with middle names, double surnames, optional prefixes and suffixes (real, _official) and digits that follow a birth_year."combat" or "leadership" (the tags of a character's traits and job); one nickname in three is then a word that suits them, from 43 shipped themes you can extend.nickname_request holds per-call choices; get_nickname(request) generates normally and get_nickname(request, seed) produces reproducible results. nickname::seed() records the seed for replay.has_wordlists() and list_names() let you verify what is loaded before generating.get_nickname(request, seed) is a pure function of the request, the seed and the word lists, and nickname::seed() replays a previous nickname..words and .tsv files or text (extend()), checked before they are applied.to_json() on every result, and a signature() recording the seed and the word lists it came from.DASMIG_NICKNAME_EMBED to build the word lists into the program, for WebAssembly and other builds without files.nng instances with their own word lists and random engine — ideal for embedding inside other generators. The classic instance() singleton is still available for convenience.nicknamegen.hpp is the library released here. Keep core.hpp and the core/ directory (dasmig-core) in the same directory. Add
to the files you want to use it in, and supply the resources folder (or define DASMIG_NICKNAME_EMBED).
Version 2 changes every seeded result; see Migrating from v1.
It's important to note that due to the necessity of supporting multiple cultures characters and the way std::string works on windows, this library uses std::wstring to return the generated nicknames.
When requesting a nickname for the first time the singleton loads the shipped word lists, from the compiled-in copy or from resources/lite (it looks in resources, ../resources, nickname-generator/resources and ../nickname-generator/resources). If the resources are elsewhere, load them manually. load(path) reads every word list below the directory and replaces what was loaded; extend(path) adds to it.
nickname_request{}.name is empty by default, selecting from word lists. A non-empty name retains the existing 25% name-derived / 75% word-list behavior (always name-derived without lists). Resource loading stays on the generator. The former string/no-argument overloads and generator-level seed() / unseed() have been removed; see Request API migration.
For the complete feature guide — transforms, word lists, extending data, compiled-in data, thread safety, and more — see the Usage Guide.
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 |
| email-generator | Email addresses in each country's style |
| entity-generator | ECS-based entity generation |
| interest-generator | Religion, hobbies and favourite media by country, age and sex |
| name-generator | Culturally appropriate full names |
| occupation-generator | Employment status, education and occupation by country, age and sex |
| persona-generator | 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 |
This library is released under the MIT License.