Documentation
¶
Overview ¶
Package randkey provides utility functions to generate random uint64 keys in different formats.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RandKey ¶
type RandKey struct {
// contains filtered or unexported fields
}
RandKey stores the random key.
func New ¶
func New() *RandKey
New generates a new uint64 random key.
Example ¶
package main
import (
"fmt"
"github.com/tecnickcom/gogen/pkg/randkey"
)
func main() {
// generate a new key
k := randkey.New()
fmt.Println(k)
}
func (*RandKey) Hex ¶
Hex returns a fixed-length 16 digits hexadecimal string key.
Example ¶
package main
import (
"fmt"
"github.com/tecnickcom/gogen/pkg/randkey"
)
func main() {
// generate a new random key as fixed-length 16 digits hexadecimal string key.
k := randkey.New().Hex()
fmt.Println(k)
}
func (*RandKey) Key ¶
Key returns a uint64 key.
Example ¶
package main
import (
"fmt"
"github.com/tecnickcom/gogen/pkg/randkey"
)
func main() {
// generate a new random key as uint64
k := randkey.New().Key()
fmt.Println(k)
}
Click to show internal directories.
Click to hide internal directories.