Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Die ¶
type Die interface { // Roll rolls a new number. Roll() uint64 // MaxValue returns the max number this die will ever roll, // inclusive. MaxValue() uint64 // MinValue returns the min number this die will ever roll. MinValue() uint64 }
Die is the interface that provides the methods Roll, MaxValue, and MinValue. This package provides (private) implementors that are returned through the New* functions.
func New0Based ¶
New0Based returns a new die that will rolls numbers between 0 and `maxValue` exclusive. I.e., 0 <= die.Roll() < `maxValue`.
New0Based calls New0BasedWithSeed passing time.Now().UnixNano() as the seed.
func New0BasedWithSeed ¶
New0BasedWithSeed returns a new die that will roll numbers between 0 and `maxValue` exclusive. I.e., 0 <= die.Roll() < `maxValue`.
The internal rand.Rand object will use `seed` as its seed.
func New1Based ¶
New1Based returns a new die that will rolls numbers between 1 and `maxValue` inclusive. I.e., 1 <= die.Roll() <= `maxValue`.
New1Based calls New1BasedWithSeed passing time.Now().UnixNano() as the seed.
func New1BasedWithSeed ¶
New1BasedWithSeed returns a new die that will roll numbers between 1 and `maxValue` inclusive. I.e., 1 <= die.Roll() <= `maxValue`.
The internal rand.Rand object will use `seed` as its seed.