poisson

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Descriptor

type Descriptor struct {
	Lambda float64
	Max    uint64
}

Descriptor describes a Poisson process.

func (*Descriptor) Equals

func (d *Descriptor) Equals(s *Descriptor) bool

Equals return true if the given Descriptor s is equal to d.

type Fount

type Fount struct {
	Timer *time.Timer
	// contains filtered or unexported fields
}

Fount is used to produce channel events after delays selected from a Poisson process.

func NewTimer

func NewTimer(desc *Descriptor) *Fount

NewTimer is used to create a new Fount. A subsequent call to the Start method is used to activate the timer.

func (*Fount) Channel

func (t *Fount) Channel() <-chan time.Time

func (*Fount) DescriptorEquals

func (t *Fount) DescriptorEquals(s *Descriptor) bool

DescriptorEquals returns true if the Fount's Poisson descriptor is equal to the given Poisson descriptor s.

func (*Fount) Next

func (t *Fount) Next()

Next resets the timer to the next Poisson process value. This MUST NOT be called unless the timer has fired.

func (*Fount) NextMax

func (t *Fount) NextMax()

NextMax resets the timer to the maximum possible value.

func (*Fount) SetPoisson

func (t *Fount) SetPoisson(desc *Descriptor)

SetPoisson sets a new Poisson descriptor.

func (*Fount) Start

func (t *Fount) Start()

Start is used to initialize and start the timer after timer creation.

func (*Fount) Stop

func (t *Fount) Stop()

Stop stops the timer.

Jump to

Keyboard shortcuts

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