randexp

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RandexpGenerator

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

RandexpGenerator generates random strings that match a compiled regex pattern. It uses regexp/syntax to parse the pattern, then walks the resulting AST. Safe for concurrent use: the generator is immutable after construction; callers supply their own *rand.Rand on each Generate call.

func NewRandexpGenerator

func NewRandexpGenerator(pattern string) (*RandexpGenerator, error)

NewRandexpGenerator parses pattern and returns a generator ready to call Generate.

func (*RandexpGenerator) Generate

func (g *RandexpGenerator) Generate(rng *rand.Rand) string

Generate returns a new random string matching the pattern. rng must not be shared across goroutines; each goroutine should pass its own.

Jump to

Keyboard shortcuts

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