rng

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RandProvider = NewPseudoRandom()

RandProvider is the default random number generator the api will use.

Functions

This section is empty.

Types

type PseudoRandom

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

PseudoRandom implements the Random interface using the built-in rand package.

func (*PseudoRandom) Intn

func (p *PseudoRandom) Intn(lower, upper int) int

Intn generates a random integer in the [lower, upper) half-open interval. If upper < lower it panics.

type Random

type Random interface {
	// Intn generates a random integer in the [lower, upper)
	// half-open interval.
	Intn(lower, upper int) int
}

Random provides functions to generate random numbers

func NewPseudoRandom

func NewPseudoRandom() Random

NewPseudoRandom returns a new Random backed by the PseudoRandom implementation.

Jump to

Keyboard shortcuts

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