Skip to content

namegenerator is a Golang package that provides a simple yet powerful tool for generating human-readable and pronounceable random names.

License

Notifications You must be signed in to change notification settings

0x6flab/namegenerator

namegenerator

Coverage Status Go Report Card Go Reference GitHub GitHub go.mod Go version GitHub repo size Maintainability Continuous Integration

NameGenerator is a Golang package that provides a simple yet powerful tool for generating human-readable and pronounceable random names. The names are generated by namegenerator.py from https://www.cs.cmu.edu/ dataset.

Installation

go get github.com/0x6flab/namegenerator

Usage

package main

import (
    "fmt"

    "github.com/0x6flab/namegenerator"
)

func main() {
    generator := namegenerator.NewGenerator()

    // Generate a random name
    name := generator.Generate()

    // Print the name
    fmt.Println(name)
}

Examples

See examples directory for more examples.

Benchmarks

Benchmark tests can be found in test file and collision tests can be found in test file.

goos: linux
goarch: amd64
pkg: github.com/0x6flab/namegenerator
cpu: AMD Ryzen 7 7735HS with Radeon Graphics
BenchmarkNameGenerator_Generate-16                967677              1158 ns/op
BenchmarkNameGenerator_Generate10Names-16          97788             11577 ns/op
BenchmarkNameGenerator_Generate1KNames-16            973           1156777 ns/op
BenchmarkNameGenerator_Generate10KNames-16            88          11594857 ns/op

For collision tests:

Number of Names Options Collisions Collision range
1K with random string (2) or (5) 0 0
10K with random string (2) or (5) 0 0
100K with random string (2) or (5) 0 0
1M with random string (2) or (5) 0 0
1K without 0 0
10K without 0 0
100K without 1 0-5
1M without 147 135-163
1K male names 0 0
10K male names 1 0-4
100K male names 127 105-152
1M male names 12516 12394-12630
1K female names 0 0
10K female names 0 0-3
100K female names 74 57-98
1M female names 7404 7289-7542

License

This project is licensed under the Apache-2.0 LICENSE - see the LICENSE file for details.

About

namegenerator is a Golang package that provides a simple yet powerful tool for generating human-readable and pronounceable random names.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published