feat(Go-Tool):

2021/03/02: 新增字符串匹配 暴力匹配、KMP匹配、SunDay匹配算法
            2021/03/02: 修复Rand包随机获取方法
This commit is contained in:
Huangzj
2021-03-02 13:33:07 +08:00
parent 74dd19c675
commit dc5d924a2c
13 changed files with 385 additions and 7 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* @Author : huangzj
* @Time : 2020/6/29 10:48
* @Description这边的随机获取没有加锁,对于一些需要加锁的场景可以在外面再包装一层
* @Description
*/
package rand
@@ -47,7 +47,7 @@ func GetRandIntNoRepeat(count, min, max int) []int {
return randAttr
}
//从一个数组中获取到X个不重复随机数
//从一个数组中获取到X个不重复下标的随机数
func GetDiffNum(data []int, count int) []int {
if count > len(data) {
panic("获取随机数数量有误")