You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- // Copyright © 2023 OpenIMSDK open source community. All rights reserved.
- // Licensed under the MIT License (the "License");
- // you may not use this file except in compliance with the License.
-
- package utils
-
- import (
- "math/rand"
- "time"
- )
-
- // Generate a random code with length 6
- func GenerateCode() string {
- dataset := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()"
- rand.Seed(time.Now().UnixNano())
-
- code := make([]byte, 6)
- for i := 0; i < 6; i++ {
- code[i] = dataset[rand.Intn(len(dataset))]
- }
-
- return string(code)
- }
|