Documentation
¶
Index ¶
- Variables
- func Float32() float32
- func Float64() float64
- func Int[T SignedIntegers]() T
- func IntInterval[T SignedIntegers](min, max T) T
- func NewHashPool(size int) *hashPool
- func Uint[T UnsignedIntegers]() T
- func UintInterval[T UnsignedIntegers](min, max T) T
- type Integers
- type MulticastScope
- type SignedIntegers
- type UnicastType
- type UnsignedIntegers
Constants ¶
This section is empty.
Variables ¶
var DefaultHashPool = NewHashPool(50)
DefaultHashPool is a globally accessible hashPool with a preallocated size.
var Network network
var Word word
Functions ¶
func Float32 ¶ added in v1.4.0
func Float32() float32
Float32 generates a random 32-bit float value in the range [0, 1) using the hashPool. It retrieves a random 32-bit number from the hash pool, masks the result to retain only the lower 24 bits, and converts it into a float32 by dividing by 2^24 to normalize the value into the range [0, 1).
func Float64 ¶ added in v1.4.0
func Float64() float64
Float64 generates a random 64-bit float value in the range [0, 1) using the hashPool. It retrieves a random 64-bit number from the hash pool, masks the result to retain only the lower 53 bits, and converts it into a float64 by dividing by 2^53 to normalize the value into the range [0, 1).
func Int ¶ added in v1.4.0
func Int[T SignedIntegers]() T
Int generates a random signed integer of type T.
func IntInterval ¶ added in v1.4.0
func IntInterval[T SignedIntegers](min, max T) T
IntInterval generates a random signed integer of type T within a specified range.
func NewHashPool ¶ added in v1.1.0
func NewHashPool(size int) *hashPool
NewHashPool creates a new hashPool with the specified size. If size is 0, it returns nil. The pool will preallocate size maphash.Hash objects for reuse.
func Uint ¶ added in v1.4.0
func Uint[T UnsignedIntegers]() T
Uint generates a random unsigned integer of type T.
func UintInterval ¶ added in v1.4.0
func UintInterval[T UnsignedIntegers](min, max T) T
UintInterval generates a random unsigned integer of type T within a specified range.
Types ¶
type Integers ¶ added in v1.1.0
type Integers interface {
SignedIntegers | UnsignedIntegers
}
type MulticastScope ¶ added in v1.3.0
type MulticastScope uint8
ref: https://datatracker.ietf.org/doc/html/rfc3513#section-2.7
const ( InterfaceLocalScope MulticastScope = 0x1 LinkLocalScope MulticastScope = 0x2 AdminLocalScope MulticastScope = 0x4 SiteLocalScope MulticastScope = 0x5 OrgLocalScope MulticastScope = 0x8 GlobalScope MulticastScope = 0xE )
type SignedIntegers ¶ added in v1.1.0
type UnicastType ¶ added in v1.3.0
type UnicastType uint8
ref: https://datatracker.ietf.org/doc/html/rfc3513#section-2.5
const ( GlobalType UnicastType = iota + 1 LinkLocalType SiteLocalType UniqueLocalType PrivateType UnicastType = UniqueLocalType )