Nickname Generator 1.2.1
Gamer-style nickname generation for C++23
Loading...
Searching...
No Matches
Nickname Generator for C++

Requires C++23 (e.g., -std=c++23 for GCC/Clang, /std:c++latest for MSVC).

Nickname Generator for C++

GitHub license CI GitHub Releases GitHub Issues C++23 Header-only Platform Documentation

API Reference · Usage Guide · Releases

Features

The library currently supports the following:

  • Nickname Generation. The library randomly generates a nickname based on either a name or a list of words.
  • Leetifying Process. After selecting a name/word it will randomly apply any number of customizations to uniquefy the nickname.
  • Word Lists Supported. Currently the following word lists are supported and a matching database is packed together with the library:
    • Adjectives
    • Animals
    • Japanese
  • Deterministic Seeding. Per-call get_nickname(name, seed) for reproducible results, generator-level seed() / unseed() for deterministic sequences, and nickname::seed() for replaying a previous generation.
  • Resource Inspection. has_wordlists() lets you verify resources loaded before generating.
  • Multi-Instance Support. Construct independent 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.

Integration

nicknamegen.hpp is the single required file released here. You need to add

// For convenience.
using nng = dasmig::nng;
Nickname generator that produces gamer-style nicknames.
Nickname generator library — gamer-style nickname generation for C++23.

to the files you want to generate nicknames and set the necessary switches to enable C++23 (e.g., -std=c++23 for GCC and Clang).

Additionally you must supply the nickname generator with the resources folder also available in the release.

Usage

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 library will attempt to load the resource files containing each word list (the default path is ./resources). It's important to manually load the resources folder if it's present in a different location. The library will recursively iterate through all entries in the loading directory, so only a single call to the root folder containing the word lists is necessary.

// For convenience.
using nng = dasmig::nng;
// Manually load the resources folder if necessary.
nng::instance().load("path/to/resources");
// Generate a nickname based on a player name.
std::wstring github_nickname = nng::instance().get_nickname(L"Kind Github User");
// Generate a random nickname from the loaded word lists.
std::wstring random_nickname = nng::instance().get_nickname();
// Access the original source string.
auto nick = nng::instance().get_nickname(L"Jane Doe");
std::wcout << nick.plain() << L" -> " << nick << std::endl;
// Deterministic generation — same seed always produces the same nickname.
auto seeded = nng::instance().get_nickname(L"Jane Doe", 42);
// Replay a previous nickname using its seed.
auto replay = nng::instance().get_nickname(L"Jane Doe", seeded.seed());
// Seed the engine for a deterministic sequence.
nng::instance().seed(100);
// ... generate nicknames ...
nng::instance().unseed(); // restore non-deterministic state
// Independent instance — separate word lists and random engine.
nng my_gen;
my_gen.load("path/to/resources");
std::wstring nick2 = my_gen.get_nickname(L"Own Instance");
void load(const std::filesystem::path &resource_path)
Load word list files from a directory.

For the complete feature guide — transforms, word lists, thread safety, and more — see the Usage Guide.

Related Libraries

Library Description
name-generator Culturally appropriate full names
birth-generator Demographically plausible birthdays
biodata-generator Procedural human physical characteristics
city-generator Weighted city selection by population
country-generator Weighted country selection by population
entity-generator ECS-based entity generation