Giter Club home page Giter Club logo

namegen's Introduction

namegen
GitHub license GoReportCard Go Reference

preview

What's this?

Go package and associated command line utility to generate random yet human-readable names and identifiers. Somewhat inspired by the random names that Docker gives its containers and GCP uses as project-ids.

Use it to generate email-ids, gamer-tags, component-ids, passwords or startup names.

For instance, it came up with gems like: boujee-coorgi, young-flamingo, articulate-otter-92, ancient-mako-7ab1g3 and mighty-pale-pikachu-7133.

Features

  • 1 Million+ unique possibilities with just names and nearly infinite named ids
  • Zero Allocations! No additional memory allocations other than the string returned
  • Blazing fast!! (10,000,000+ Op/s)

API & Usage

Generate names using default config.

ngen := namegen.New()
fmt.Println(ngen.Get()) // twisted-flamingo

Configure name generator to generate named ids of the form "adjective-color-animal-xxxx".

name_schema := []namegen.DictType{
	namegen.Adjectives,
	namegen.Colors,
	namegen.Animals,
}
ngen := namegen.NewWithPostfixId(name_schema, namegen.Numeric, 4)
fmt.Println(ngen.Get()) // energetic-pink-pug-3729

Go Reference


Benchmarks

goos: linux
goarch: amd64
pkg: github.com/anandvarma/namegen
cpu: AMD Ryzen 5 3600 6-Core Processor              
BenchmarkNew-12                 1000000000               0.2561 ns/op          0 B/op          0 allocs/op
BenchmarkGet-12                 14617033                82.80 ns/op           18 B/op          1 allocs/op
BenchmarkGetForId-12            21623218                51.25 ns/op           16 B/op          1 allocs/op
BenchmarkGetWithPostfix-12      10882941               111.7 ns/op            26 B/op          1 allocs/op
BenchmarkGetPostfixId-12        31611556                37.07 ns/op           20 B/op          0 allocs/op
PASS
ok      github.com/anandvarma/namegen   5.293s

namegen's People

Contributors

anandvarma avatar rafiramadhana avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.