-
Notifications
You must be signed in to change notification settings - Fork 24
On .NET Framework with a version before 2.1.0, new PersonNameGenerator() created its own new Random(), seeded from the clock, so generators created in the same tick produced the same sequence (issue #7). Upgrade to 2.1.0 or later: default generators now share Random.Shared on .NET 6 and later and take distinct seeds from a process-wide source everywhere else. On any version, creating one generator and reusing it also avoids the problem.
The lists have their frequencies stripped, so every one of the 88,799 last names is as likely as Smith, and most surnames on a census list are rare. Vanvolkinburg and Niceswander are real Census entries, just uncommon ones. If you want common-looking names, the lists are in Census order with the most frequent first, so pick from PersonNameGenerator.LastNames.Take(500) with your own Random.
GenerateRandomFirstName picks male or female with equal probability and then a name from that list. There are 1,219 male and 4,275 female first names, so any one male name is about 3.5 times likelier than any one female name. Use GenerateRandomMaleFirstName and GenerateRandomFemaleFirstName when the odds within a list matter.
No. The lists are names, not people. The Census published how often each first name and each surname occurred, without linking them, and any full name the library produces is a random pairing. A match with a real person is chance.
No. The person lists are the 1990 US Census (English spelling, ASCII, Title case) and the place list is the Census 2000 places file for the United States and Puerto Rico. The star names are international by nature.
Not through the API; the static lists are read-only. You can filter or combine them and pick with your own Random (see Recipes), or implement IPersonNameGenerator yourself over a different data set.
No. Everything comes from System.Random. The names are for test data, fixtures, games and demos, never for passwords, tokens or anything an attacker must not predict.
No. The seven lists are embedded in the assembly and parsed once per process, on first use. There is nothing to configure.
The download is 943 KB and the assembly about 1 MB, of which 977 KB is the lists; the 88,799 last names alone are 695 KB. After first use the lists live in memory as arrays of strings.
52 place names carry accents (Mayagüez zona urbana), and star names use diacritics and superscript digits (Boötis, Delta² Gruis). The strings are right; the console is not showing them. Set Console.OutputEncoding = System.Text.Encoding.UTF8; before writing, or write to a UTF-8 file.
The lists can be read from any thread. On .NET 6 and later a generator from the default constructor uses Random.Shared and can be shared. A generator built on a Random you supplied, an extension method call, or a default generator on .NET Framework uses a plain Random, which is not thread-safe: use one per thread.
Person names have been the same for a given seed since 1.2.2. Place names changed in 2.1.0 and 2.3.0 because the list changed. Star names exist since 2.2.0 and have not changed. Every answer of 2.2.0 is recorded and replayed by the repository's tests, so any change is deliberate and in the changelog. See Reproducible names.
The net10.0 build is marked trimmable and AOT compatible. The netstandard2.0 build uses no reflection beyond reading its own embedded resources.
Yes, with the netstandard2.0 build. See Getting started.
The return type dates from 1.x and stays for compatibility. The object is a List<string>, so ToList() copies it, Count() is cheap, and enumerating twice gives the same names.
Bugs and questions go to the issues. Security concerns follow SECURITY.md in the repository.
This wiki describes RandomNameGeneratorLibrary 2.3.0 and was last updated on 2026-09-28. The library is MIT licensed. Report problems in the issues.