polyhedral

package
v0.0.0-...-7afa4bb Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Die

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

Die represents an individual polyhedral die. It has a positive number of sides.

func NewD10

func NewD10(seed *int64) Die

NewD10 returns a new d10.

func NewD100

func NewD100(seed *int64) Die

NewD100 returns a new d100.

func NewD12

func NewD12(seed *int64) Die

NewD12 returns a new d12.

func NewD20

func NewD20(seed *int64) Die

NewD20 returns a new d20.

func NewD4

func NewD4(seed *int64) Die

NewD4 returns a new d4.

func NewD6

func NewD6(seed *int64) Die

NewD6 returns a new d6.

func NewD8

func NewD8(seed *int64) Die

NewD8 returns a new d8.

func (Die) Eval

func (d Die) Eval() int

Convenience function to roll a die a single time.

func (Die) Roll

func (d Die) Roll(times uint) int

Roll rolls the Die and returns the score.

func (Die) RollWithScores

func (d Die) RollWithScores(times uint) (int, []int)

RollWithScores rolls the Die times number of times. It returns the score both as a sum and as a slice of the individual scores.

func (Die) Seed

func (d Die) Seed() int64

Seed returns the value used by the instance to seed the PRNG.

func (Die) Sides

func (d Die) Sides() uint

Sides returns the number of sides the receiver has.

func (Die) String

func (d Die) String() string

String returns a human-readable representation of the Die, e.g., "d6".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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