client: Index | Files

package poisson

import ""


Package Files


type Descriptor Uses

type Descriptor struct {
    Lambda float64
    Max    uint64

Descriptor describes a Poisson process.

func (*Descriptor) Equals Uses

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

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

type Fount Uses

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 Uses

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 Uses

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

func (*Fount) DescriptorEquals Uses

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 Uses

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 Uses

func (t *Fount) NextMax()

NextMax resets the timer to the maximum possible value.

func (*Fount) SetPoisson Uses

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

SetPoisson sets a new Poisson descriptor.

func (*Fount) Start Uses

func (t *Fount) Start()

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

func (*Fount) Stop Uses

func (t *Fount) Stop()

Stop stops the timer.

Package poisson imports 4 packages (graph) and is imported by 2 packages. Updated 2019-06-19. Refresh now. Tools for package owners.