Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PathGenerator ¶
Generates paths, separated with a slash or custom separator. The paths have a random number of filenames in them, and the filenames consist of random characters of random length. The generated sequences are reproducible, controlled by the RandSeed option.
func New ¶
func New(o PathGeneratorOptions) *PathGenerator
Creates a path generator with the provided options, falling back to the default value for each non-specified option field.
func (*PathGenerator) Between ¶
func (pg *PathGenerator) Between(min, max int) int
takes a random number positioned between [min, max)
func (*PathGenerator) Name ¶
func (pg *PathGenerator) Name() string
generates a random name using the available characters and of length within the defined boundaries
func (*PathGenerator) Names ¶
func (pg *PathGenerator) Names() []string
generates random names of count between the defined boundaries
func (*PathGenerator) Next ¶
func (pg *PathGenerator) Next() string
Generates a random path.
The path will be always absolute.
The path may contain a closing slash, with a probability based on the `ClosingSlashInEveryN`. If `ClosingSlashInEveryN < 0`, the path won't contain a closing slash. If `ClosingSlashInEveryN == 0`, the path will always contain a closing slash. If `ClosingSlashInEveryN == n`, where `n > 0`, then the generated path will contain a closing slash with a chance of `1 / n`.
The path will contain a random number of names (the thing between the slashes), equally distributed between `MinNamesInPath` and `MaxNamesInPath`.
The names in the path will have a random length, equally distributed between `MinFilenameLength` and `MaxFilenameLength`.
The sequence followed by `Next` is reproducible, to get a different sequence, a new PathGenerator instance is required, with a different `RandSeed` value.
func (*PathGenerator) Str ¶
func (pg *PathGenerator) Str(min, max int) string
func (*PathGenerator) Strs ¶
func (pg *PathGenerator) Strs(min, max, minLength, maxLength int) []string