BenScr.Names 1.0.0

dotnet add package BenScr.Names --version 1.0.0
                    
NuGet\Install-Package BenScr.Names -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BenScr.Names" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BenScr.Names" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="BenScr.Names" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BenScr.Names --version 1.0.0
                    
#r "nuget: BenScr.Names, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BenScr.Names@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BenScr.Names&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=BenScr.Names&version=1.0.0
                    
Install as a Cake Tool

BenScr.Names

Seeded name generation with immutable custom catalogs for .NET 9 and .NET 10. The package includes 41,588 historical first-name entries and 88,799 last-name entries, with no runtime dependencies.

Created by Ben Schneider — https://github.com/Ben-Scr

dotnet add package BenScr.Names --version 1.0.0
using BenScr.Names;

var names = new NameGenerator(seed: 42);
string fullName = names.FullName(2);

var catalog = new NameCatalog(
    ["Ada", "Bea", "Cora"],
    ["Oak", "Pine"]);
var custom = new NameGenerator(catalog, seed: 0);
string result = custom.FullName(2); // Bea Ada Pine

var preserved = new NameGenerator(
    new NameCatalog(["Jean-Luc"], ["O'Neill"]), seed: 3, NameCasing.Preserve);
string exactSpelling = preserved.FullName(); // Jean-Luc O'Neill

The complete example checks seeded output, embedded catalogs and casing.

Contracts

FirstName() and LastName() draw independently with replacement. Duplicates are allowed, and results are not unique identifiers or representations of real people. FullName(n) draws n first-name parts followed by a last name, separated by single spaces; n must be 1–32 inclusive. Invalid counts consume no random state. Calls allocate returned strings and, for full names, a temporary builder.

The default InitialCapital casing uppercases the first UTF-16 character and lowercases the rest using invariant .NET casing. It preserves historical behavior: O'NEILL becomes O'neill, not a linguistically inferred spelling. Preserve returns entries unchanged, without Unicode normalization.

Custom catalogs copy both input lists. Each must contain 1–100,000 entries, each 1–256 UTF-16 code units, with a combined budget of 8,388,608 code units. Entries must start with a BMP Unicode letter; remaining characters may be BMP letters, combining marks, ASCII apostrophes or hyphens. Spaces, digits, controls and surrogate code units are rejected. This deliberately excludes non-BMP names; no claim of universal human-name validation is made. Catalogs do not infer culture, gender or origin. Use application-selected lists to define a category. Ordering and duplicate entries are retained, so repeating a name increases its selection weight.

NameCatalog.FirstNames/LastNames are read-only views. Input arrays cannot mutate a catalog after construction. Catalogs can be shared concurrently, but each generator owns mutable state and needs external synchronization. Input lists must remain stable while their constructor copies them.

The legacy static FirstNamesCount(), LastNamesCount(), GetFirstNames() and GetLastNames() always refer to the embedded catalog. The getters return fresh arrays of raw spellings. Embedded lists keep the original filter, ordering and duplicate weights; they have no verified language or gender labels. See data provenance.

Reproducibility

AlgorithmId is splitmix64-name-selection-v1. Any ulong seed, including zero, is valid. Each raw step adds 0x9E3779B97F4A7C15 to state, mixes with right shifts 30/27/31 and multipliers 0xBF58476D1CE4E5B9 and 0x94D049BB133111EB; arithmetic wraps modulo 2^64. For a list of size b, discard values smaller than (2^64 mod b), then select value mod b. This avoids incomplete residue groups. Seed zero begins with e220a8397b1dcdaf, 6e789e6aa1b965f4, 06c45d188009454f.

The same seed, catalog order and call sequence produce the same selection indices. Unicode casing tables follow the .NET runtime; use Preserve for output independent of those casing rules. Catalog changes can change seeded names and are compatibility changes. Constructors without a seed use eight bytes from RandomNumberGenerator for initialization; subsequent draws are not cryptographic. Use this library for examples, test data and simulations, not secrets or identity generation.

Build and verification

Requires .NET SDK 10.0.303, .NET 9/10 runtimes, PowerShell 7 and Git. Versions and restore locks are committed. Tests use xUnit v3 4.0.2 with Microsoft Testing Platform.

dotnet test --project tests/BenScr.Names.Tests.csproj -c Release
pwsh -File tools/Verify.ps1

Verification covers fixed integer vectors, rejection mapping, full legacy-list fingerprints, bounds, immutability, custom spelling, casing, concurrent use of shared catalogs, public API and package metadata, original assets, portable PDB/Source Link and isolated package consumers on both frameworks. Windows and Ubuntu x64 CI executes the same workflow. See the release procedure, migration mapping and changelog.

The original license requires visible author attribution. The original BenScr icon is embedded unchanged.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 111 11/2/2026