bitrand

package module
v0.0.0-...-46d37ad Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CryptoRand

func CryptoRand() uint64

CryptoRand uses Go crypto/rand to get 8 random bytes.

func FailureCountTest

func FailureCountTest(x rng, rounds int, seed uint64, h string) string

FailureCountTest --

func MultiTest

func MultiTest(x rng, rounds, numbers int, tau float64, seed uint64, h string) string

MultiTest --

func PoissonLimits

func PoissonLimits(prob, lambda float64) (obslo, obshi int, probLo, probHi float64)

PoissonLimits returns an interval of observed events [obsLo, obsHi] where P(x <= obslo) = probLo P(x >= obshi) = probHi and probLo + probHi ~ prob probLo ~ probHi probLo >= prob/2 probHi <= prob/2

func ProbPoisson

func ProbPoisson(x, lambda float64) float64

ProbPoisson returns probability to get x events when lambda events are expected.

func ProbTriangular

func ProbTriangular(f1, f2 float64) float64

ProbTriangular returns probability P(f1 <= x <= f2), where x = x1 - x2 and x1, x2 ~ Norm(0, 1). Difference of two uniform floats in [0, 1] should follow this distribution. https://en.wikipedia.org/wiki/Triangular_distribution

func PvalChi2

func PvalChi2(x, df float64) float64

PvalChi2 returns the smaller of left and right tail probability of CDF x 2.

func PvalNormal

func PvalNormal(z float64) float64

PvalNormal returns two sided probability for z ~ Norm(0, 1)

func PvalPoisson

func PvalPoisson(obs, lambda float64) float64

PvalPoisson --

func SimTests

func SimTests(x u64, tests int, seed uint64, tau float64, rank int, rounds int, extrapvals []float64) string

SimTests --

func SimTestsC

func SimTestsC(x u64, tests int, seed uint64, tau float64, rank int, rounds int, extrapvals []float64) string

SimTestsC runs simulations concurrently. Speed gain 0 - 60%.

func SingleTest

func SingleTest(x rng, numbers int, seed uint64, h string) string

SingleTest --

func Splitmix64

func Splitmix64(state *uint64) uint64

Splitmix64 --------------------------------------

Types

type Failu

type Failu struct {
	Rounds     int
	Numbers    int
	PvalFail   float64
	Seed       uint64
	CryptoSeed bool
	Tau        float64

	Pstop float64

	Reseed bool
	// contains filtered or unexported fields
}

Failu --

func FailureCounter

func FailureCounter() Failu

FailureCounter --

func (*Failu) Summary

func (f *Failu) Summary(h string) string

Summary --

func (*Failu) Test

func (f *Failu) Test(x rng)

Test --

type LCG

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

LCG ----------------------------------------------

func NewLCG

func NewLCG(seed uint64) LCG

NewLCG --

func (*LCG) Seed

func (x *LCG) Seed(seed uint64)

Seed --

func (*LCG) Uint64

func (x *LCG) Uint64() uint64

Uint64 -- https://nuclear.llnl.gov/CNP/rng/rngman/node4.html

type MCG

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

MCG implement 128-bit x 128-bit MCG generator.

func NewMCG

func NewMCG(seed uint64) MCG

NewMCG --

func (*MCG) Seed

func (x *MCG) Seed(seed uint64)

Seed --

func (*MCG) Uint64

func (x *MCG) Uint64() uint64

Uint64 is used by FailureCountTest and MultiTest for seeding

type MCG64

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

MCG64 --

func NewMCG64

func NewMCG64(seed uint64) MCG64

NewMCG64 --

func (*MCG64) Float64

func (x *MCG64) Float64() float64

Float64 --

func (*MCG64) Seed

func (x *MCG64) Seed(seed uint64)

Seed --

func (*MCG64) Uint64

func (x *MCG64) Uint64() uint64

Uint64 --

type Rand

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

Rand http://prng.di.unimi.it/xoroshiro128starstar.c

func NewRand

func NewRand(seed uint64) *Rand

NewRand --

func (*Rand) Float64

func (x *Rand) Float64() float64

Float64 --

func (*Rand) Seed

func (x *Rand) Seed(seed uint64)

Seed --

func (*Rand) Uint64

func (x *Rand) Uint64() (next uint64)

Uint64 --

type Testu

type Testu struct {
	N int

	PfailLim float64
	// contains filtered or unexported fields
}

Testu --

func Tester

func Tester(seed uint64) Testu

Tester --

func (*Testu) Fail

func (t *Testu) Fail() string

Fail --

func (*Testu) Summary

func (t *Testu) Summary(h string) string

Summary --

func (*Testu) TestAll

func (t *Testu) TestAll(u uint64)

TestAll --

func (*Testu) TestBattery

func (t *Testu) TestBattery(u uint64)

TestBattery --

Jump to

Keyboard shortcuts

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