Skip to content

Commit

Permalink
随机函数
Browse files Browse the repository at this point in the history
  • Loading branch information
Suika99 authored Jun 26, 2021
1 parent 2453c54 commit 66a8457
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions utils/random.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package utils

import (
"github.com/wdvxdr1123/ZeroBot/message"
"math/rand"
"time"
)

func RandText(text ...[]string) message.MessageSegment {
length := len(text)
rand.Seed(time.Now().UnixNano())
return message.Text(text[rand.Intn(length)])
}

func Suiji() int {
rand.Seed(time.Now().UnixNano())
return rand.Intn(30)
}

0 comments on commit 66a8457

Please sign in to comment.