Documentation ¶
Overview ¶
Package id generates unique random strings. It however should not be used for cryptography purposes.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New() string
New returns a new random string.
Example ¶
package main import ( "fmt" "github.com/komuw/ong/id" ) func main() { fmt.Println(id.New()) }
Output:
func Random ¶
Random generates a random string of size n.
If n < 1 or significantly large, it is set to reasonable bounds. It uses `crypto/rand` but falls back to `math/rand` on error.
Example ¶
package main import ( "fmt" "github.com/komuw/ong/id" ) func main() { size := 34 s := id.Random(size) if len(s) != size { panic("mismatched sizes") } fmt.Println(s) }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.