From 70ebaae3d2174c7d6ed666793089daf4fcbe0428 Mon Sep 17 00:00:00 2001 From: ayflying Date: Thu, 13 Mar 2025 15:33:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9D=83=E9=87=8D=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/random.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/random.go b/tools/random.go index d9803ba..b3f8c0c 100644 --- a/tools/random.go +++ b/tools/random.go @@ -5,8 +5,15 @@ import ( "time" ) +var ( + Rand *randMod +) + +type randMod struct { +} + // RandomAll 按权重随机选取 N 个不重复的元素 -func (m *tools) RandomAll(data map[int]int, n int) []int { +func (m *randMod) RandomAll(data map[int]int, n int) []int { if n > len(data) { return nil }