names

package
v0.1.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package names provides random name generation for agents.

Index

Constants

This section is empty.

Variables

View Source
var DefaultGenerator = New()

DefaultGenerator is a package-level generator for convenience.

Functions

func Generate

func Generate() string

Generate creates a random name using the default generator.

func GenerateUnique

func GenerateUnique(existing map[string]bool, maxAttempts int) (string, error)

GenerateUnique creates a unique random name using the default generator.

func GenerateUniqueFromList

func GenerateUniqueFromList(existingNames []string, maxAttempts int) (string, error)

GenerateUniqueFromList creates a unique random name using the default generator.

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator creates random agent names.

func New

func New() *Generator

New creates a new name generator.

func (*Generator) Generate

func (g *Generator) Generate() string

Generate creates a random adjective-animal name.

func (*Generator) GenerateUnique

func (g *Generator) GenerateUnique(existing map[string]bool, maxAttempts int) (string, error)

GenerateUnique creates a random name that doesn't exist in the given set. Returns error if unable to generate unique name after maxAttempts.

func (*Generator) GenerateUniqueFromList

func (g *Generator) GenerateUniqueFromList(existingNames []string, maxAttempts int) (string, error)

GenerateUniqueFromList creates a random name not in the given list.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL