This commit is contained in:
aozhiwei 2024-03-26 12:58:03 +08:00
parent 35f839e5d4
commit 5fe4ba1d1f

View File

@ -7,6 +7,7 @@ import (
"os" "os"
"q5" "q5"
"reflect" "reflect"
"math/rand"
) )
type MetaTable interface { type MetaTable interface {
@ -56,6 +57,13 @@ func (this *RawMetaTable[T]) PreInit1() {
func (this *RawMetaTable[T]) PostInit1() { func (this *RawMetaTable[T]) PostInit1() {
} }
func (this *RawMetaTable[T]) RandElement() *T {
if len(this.rawList) > 0 {
return this.rawList[rand.Intn(len(this.rawList))]
}
return nil
}
func (this *RawMetaTable[T]) ElementsInit(round int) { func (this *RawMetaTable[T]) ElementsInit(round int) {
type RoundInit1 interface { type RoundInit1 interface {
Init1() Init1()