dice

package
v4.88.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package dice contains common functions to generate random number. It also initialize math/rand with the time in seconds at launch time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Roll

func Roll(n int) int

Roll returns a non-negative number between 0 (inclusive) and n (exclusive).

func RollDeterministic

func RollDeterministic(n int, seed int64) int

Roll returns a non-negative number between 0 (inclusive) and n (exclusive).

func RollUint16

func RollUint16() uint16

RollUint16 returns a random uint16 value.

func RollUint64

func RollUint64() uint64

Types

type DeterministicDice

type DeterministicDice struct {
	*rand.Rand
}

func NewDeterministicDice

func NewDeterministicDice(seed int64) *DeterministicDice

func (*DeterministicDice) Roll

func (dd *DeterministicDice) Roll(n int) int

Jump to

Keyboard shortcuts

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