randstat

package module
v0.0.0-...-a8cedd3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

README

A small Go library of randomness and statistics utilities.

If you were looking for probability distributions, check out
https://github.com/aclements/go-moremath instead.

Documentation

Overview

Package randstat provides replacements for math/rand functions and methods.

The functions in this package are designed to be faster than their counterparts in math/rand, and consume (in expectation) fewer random numbers from their Source. Because they use different algorithms, they produce different sequences of random numbers.

The subpackages provide various random number generators and sampling algorithms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float64

func Float64(r rand.Source) float64

Float64 returns a pseudo-random number in the interval [0,1), given a uniformly random integer.

Unlike the rand.Rand.Float64 method, this function consumes exactly one random integer from the source r.

func Int31n

func Int31n(r rand.Source, n int32) int32

Int31n returns a uniformly random integer from the range [0,n).

n must be greater than 0. r must not be nil.

func Int63n

func Int63n(r rand.Source64, n int64) int64

Int63n returns a uniformly random integer from the range [0,n).

n must be greater than 0. r must not be nil.

func Intn

func Intn(r rand.Source64, n int) int

Intn returns a uniformly random integer from the range [0,n).

n must be greater than 0. r must not be nil.

This function is designed to be faster than math/rand.Rand.Intn on 64-bit machines. It is likely slower on 32-bit machines.

func Shuffle

func Shuffle(r rand.Source64, n int, swap func(i, j int))

Shuffle generates a random permutation.

n must not be negative. r must not be nil.

Types

This section is empty.

Directories

Path Synopsis
internal
sums
Package sums implements summation algorithms.
Package sums implements summation algorithms.
Package sampling implements random sampling algorithms.
Package sampling implements random sampling algorithms.
Package splitmix64 implements the SplitMix64 random number generator.
Package splitmix64 implements the SplitMix64 random number generator.
Package xoshiro256 implements the xoshiro256** random number generator.
Package xoshiro256 implements the xoshiro256** random number generator.

Jump to

Keyboard shortcuts

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