randutil

package
v0.0.0-...-5090d89 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package randutil provides pseudo-random number generator utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockedRand

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

LockedRand wraps rand.Rand with a mutex.

func NewLockedRand

func NewLockedRand(src rand.Source) *LockedRand

NewLockedRand returns a new rand.Rand, which is safe for concurrent use.

func (*LockedRand) Float32

func (r *LockedRand) Float32() float32

Float32 calls r.Rand.Float32 and is safe for concurrent use.

func (*LockedRand) Float64

func (r *LockedRand) Float64() float64

Float64 calls r.Rand.Float64 and is safe for concurrent use.

func (*LockedRand) Int31

func (r *LockedRand) Int31() int32

Int31 calls r.Rand.Int31 and is safe for concurrent use.

func (*LockedRand) Int63

func (r *LockedRand) Int63() int64

Int63 calls r.Rand.Int63 and is safe for concurrent use.

func (*LockedRand) Intn

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

Intn calls r.Rand.Intn and is safe for concurrent use.

func (*LockedRand) Read

func (r *LockedRand) Read(b []byte) (int, error)

Read is like rand.Rand.Read, but safe for concurrent use.

func (*LockedRand) Uint32

func (r *LockedRand) Uint32() uint32

Uint32 calls r.Rand.Uint32 and is safe for concurrent use.

Jump to

Keyboard shortcuts

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