16 lines
218 B
Go
16 lines
218 B
Go
package utils
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"fmt"
|
|
"math/big"
|
|
)
|
|
|
|
func GenCode() string {
|
|
n, err := rand.Int(rand.Reader, big.NewInt(1000000))
|
|
if err != nil {
|
|
return "000000"
|
|
}
|
|
|
|
return fmt.Sprintf("%06d", n.Int64())
|
|
} |