rand

package
v0.0.0-...-c864ae1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: BSD-2-Clause, BSD-3-Clause, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container interface {
	RandomNumberGenerator() *Rand
	SetRandomNumberGenerator(generator *Rand)
}

Container defines an interface embedding a Model

type Rand

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

Rand is a source of project-specific random numbers

func New

func New(src rand.Source) *Rand

New returns a new Rand that uses random values from src to generate other random values.

func NewTimeSeeded

func NewTimeSeeded() *Rand

New returns a new Rand that uses random values seeded from a source of the system-time to generate other random values.

func (*Rand) Float64Unitary

func (r *Rand) Float64Unitary() float64

Float64Unitary returns, as a float64, a non-negative pseudo-random number in [0,1].

func (*Rand) Int63n

func (r *Rand) Int63n(n int64) int64

Int63n returns, as an int64, a non-negative pseudo-random number in [0,n). It panics if n <= 0.

func (*Rand) Intn

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

Intn returns, as an int, a non-negative pseudo-random number in [0,n). It panics if n <= 0.

func (*Rand) Uint64

func (r *Rand) Uint64() uint64

Uint64 returns a pseudo-random 64-bit value as a uint64 from the default Source.

type RandContainer

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

RandContainer offers a struct implementing the Container interface.

func (*RandContainer) RandomNumberGenerator

func (g *RandContainer) RandomNumberGenerator() *Rand

func (*RandContainer) SetRandomNumberGenerator

func (g *RandContainer) SetRandomNumberGenerator(generator *Rand)

Jump to

Keyboard shortcuts

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