rsg

package
v0.0.0-...-ad86efc Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2016 License: Apache-2.0 Imports: 5 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.

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) 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