You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.5 KiB

package lottery
import (
"GenshinImpact/global"
"fmt"
"math/rand"
"strconv"
"testing"
)
func TestPickWeapon(t *testing.T) {
totalRare := 0
totalEpic := 0
epicList := []string{}
preEpicNo := 0 //保存上一个epic号
for i := 1; i <= 240; i++ {
preEpicNo = global.LastEpicWeapon
res := PickWeaponUp()
if global.LastRareWeapon == 0 || global.LastEpicWeapon == 0 {
fmt.Println(i, global.LastRareWeapon, global.LastEpicWeapon, res)
if global.LastRareWeapon == 0 {
totalRare += 1
}
if global.LastEpicWeapon == 0 {
epicList = append(epicList, strconv.Itoa(preEpicNo+1)+res)
totalEpic += 1
}
}
}
fmt.Println("totalRare", totalRare)
fmt.Println("totalEpic", totalEpic)
fmt.Println("epicList", epicList)
}
func TestPickChar(t *testing.T) {
totalRare := 0
totalEpic := 0
epicList := []string{}
preEpicNo := 0 //保存上一个epic号
for i := 1; i <= 10000000; i++ {
preEpicNo = global.LastEpic
res := PickCharUp()
if global.LastRare == 0 || global.LastEpic == 0 {
//fmt.Println(i, global.LastRare, global.LastEpic, res)
if global.LastRare == 0 {
totalRare += 1
}
if global.LastEpic == 0 {
epicList = append(epicList, strconv.Itoa(preEpicNo+1)+res)
totalEpic += 1
}
}
}
fmt.Println("totalRare", totalRare)
fmt.Println("totalEpic", totalEpic)
fmt.Println("totalEpic/total", 10000000.00/totalEpic)
fmt.Println("epicList", epicList)
}
func TestRandom(t *testing.T) {
for {
fmt.Println(rand.Intn(10))
}
}