Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 1.18 KB

File metadata and controls

65 lines (50 loc) · 1.18 KB

Codename

an RFC1178 implementation to generate pronounceable, sometimes even memorable, "superhero like" codenames, consisting of a random combination of adjective and noun.

Usage

Codename it's a package, so all you need to do is import it into your code (Try it!):

package main

import (
	"fmt"
	"github.com/mindfarm/codename"
)

func main() {
	rng, err := codename.DefaultRNG()
	if err != nil {
		panic(err)
	}

	for i := 0; i < 8; i++ {
		name := codename.Generate(rng, 0)
		fmt.Println(name)
	}
}

This is how the output looks like (since it's random your will be different).

absolutekaratecha
movingcolleen
gamenova
finemadrox
propenguin
keenmorbius
firmiron
refinedepoch

You can request the addition of a token to create even more entropy (Try it!):

package main

import (
	"fmt"
	"github.com/mindfarm/codename"
)

func main() {
	rng, err := codename.DefaultRNG()
	if err != nil {
		panic(err)
	}

	for i := 0; i < 8; i++ {
		name := codename.Generate(rng, 4)
		fmt.Println(name)
	}
}