rsg

package
v0.0.0-...-eee24c0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RSG

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

RSG is a random syntax generator.

func NewRSG

func NewRSG(seed int64, y string) (*RSG, error)

NewRSG creates a random syntax generator from the given random seed and yacc file.

func (*RSG) Float64

func (r *RSG) Float64() float64

Float64 returns a random float. It is sometimes +/-Inf, NaN, and attempts to be distributed among very small, large, and normal scale numbers.

func (*RSG) Generate

func (r *RSG) Generate(root string, depth int) string

Generate generates a unique random syntax from the root node. At most depth levels of token expansion are performed. An empty string is returned on error or if depth is exceeded. Generate is safe to call from mulitipule goroutines. If Generate is called more times than it can generate unique output, it will block forever.

func (*RSG) GenerateRandomArg

func (r *RSG) GenerateRandomArg(typ parser.Type) string

GenerateRandomArg generates a random, valid, SQL function argument of the spcified type.

func (*RSG) Int63

func (r *RSG) Int63() int64

Int63 returns a random int64.

func (*RSG) Intn

func (r *RSG) Intn(n int) int

Intn returns a random int.

Directories

Path Synopsis
Package yacc parses .y files.
Package yacc parses .y files.

Jump to

Keyboard shortcuts

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