testrand

package
v0.8.1-0...-a25970e Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package testrand provides random generation and flags for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rand

type Rand interface {
	ExpFloat64() float64
	Float32() float32
	Float64() float64
	Int() int
	Int31() int32
	Int31n(n int32) int32
	Int63() int64
	Int63n(n int64) int64
	Intn(n int) int
	NormFloat64() float64
	Perm(n int) []int
	Read(p []byte) (n int, err error)
	Seed(seed uint64)
	Shuffle(n int, swap func(i, j int))
	Uint32() uint32
	Uint64() uint64
	Uint64n(n uint64) uint64
}

Rand corresponds to golang.org/x/exp/rand.Rand.

func New

func New(tb TB) Rand

New returns a new random number generator using the global flags.

type Source

type Source = rand.Source

Source corresponds to the interface in golang.org/x/exp/rand.Source.

func NewSource

func NewSource(tb TB) Source

NewSource returns a new source for random numbers.

type TB

type TB interface {
	Logf(format string, args ...interface{})
}

TB is an interface that corresponds to a subset of *testing.T and *testing.B.

Jump to

Keyboard shortcuts

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