Documentation
¶
Index ¶
- type Rand
- func (r *Rand) Int32Within(bound int32) (int32, error)
- func (r *Rand) Int64Within(bound int64) (int64, error)
- func (r *Rand) IntBetween(low int, high int) (int, error)
- func (r *Rand) IntWithin(bound int) (int, error)
- func (r *Rand) MustIntBetween(low int, high int) int
- func (r *Rand) MustIntWithin(bound int) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rand ¶
Rand is a rand with more useful methods
func (*Rand) Int32Within ¶
Int32Within return a random int32 value within range [0, bound) if bound larger than 0, return an error if bound is less than or equals 0.
func (*Rand) Int64Within ¶
Int64Within return a random int64 value within range [0, bound). If bound is less than or equals with 0, return an error
func (*Rand) IntBetween ¶
IntBetween return a random value within range [low, high) if low less than high, return an error if low is larger than or equals high, or high-low overflows int.
func (*Rand) IntWithin ¶
IntWithin return a random value within range [0, bound) if bound larger than 0, return an error if bound is less than or equals 0.
func (*Rand) MustIntBetween ¶
MustIntBetween return a random value within range [low, high). panics if low is larger than or equals high, or high-low overflows int.
func (*Rand) MustIntWithin ¶
MustIntWithin return a random value within range [0, bound) if bound larger than 0. panics bound is less than or equals 0.