cockroach: Index | Files | Directories

package rsg

import ""


Package Files


type RSG Uses

type RSG struct {
    Rnd *rand.Rand
    // contains filtered or unexported fields

RSG is a random syntax generator.

func NewRSG Uses

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

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

func (*RSG) Float64 Uses

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 Uses

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 Uses

func (r *RSG) GenerateRandomArg(typ *types.T) string

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

func (*RSG) Int63 Uses

func (r *RSG) Int63() int64

Int63 returns a random int64.

func (*RSG) Intn Uses

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

Intn returns a random int.


yaccPackage yacc parses .y files.

Package rsg imports 9 packages (graph). Updated 2020-05-16. Refresh now. Tools for package owners.