Skip to content

Commit 71c5de5

Browse files
authored
Merge pull request #241 from wziww/master
Code optimization
2 parents 12a161b + 15cb852 commit 71c5de5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

framework/crypto/cryptos.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package cryptos
22

33
import (
44
"crypto/md5"
5-
"math/rand"
65
"encoding/hex"
6+
"math/rand"
77
"time"
88
)
99

@@ -17,7 +17,7 @@ func GetMd5String(s string) string {
1717
// GetRandString returns randominzed string with given length
1818
func GetRandString(length int) string {
1919
bytes := []byte("0123456789abcdefghijklmnopqrstuvwxyz")
20-
result := []byte{}
20+
result := make([]byte, 0, length)
2121
r := rand.New(rand.NewSource(time.Now().UnixNano()))
2222
for i := 0; i < length; i++ {
2323
result = append(result, bytes[r.Intn(len(bytes))])

0 commit comments

Comments
 (0)