diff --git a/README.md b/README.md index c50795c..ccaea25 100644 --- a/README.md +++ b/README.md @@ -1097,6 +1097,12 @@ import "github.com/duke-git/lancet/v2/random" - **RandUniqueIntSlice** : generate a slice of random int of length n that do not repeat. [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandUniqueIntSlice)] [[play](https://go.dev/play/p/uBkRSOz73Ec)] +- **RandSymbolChar** : Generate a random symbol char of specified length. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandSymbolChar)] +- **RandFloat** : Generate a random float64 number between [min, max) with specific precision. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFloat)] +- **RandFloats** : Generate a slice of random float64 numbers of length n that do not repeat. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/random.md#RandFloats)]

17. Retry package is for executing a function repeatedly until it was successful or canceled by the context.        index

@@ -1340,6 +1346,8 @@ import "github.com/duke-git/lancet/v2/slice" - **Partition** : partition all slice elements with the evaluation of the given predicate functions. [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Partition)] [[play](https://go.dev/play/p/lkQ3Ri2NQhV)] +- **Random** : get a random item of slice, return its index, when slice is empty, return -1. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/en/api/packages/slice.md#Random)]

19. Stream package implements a sequence of elements supporting sequential and operations. this package is an experiment to explore if stream in go can work as the way java does. its function is very limited.        index

diff --git a/README_zh-CN.md b/README_zh-CN.md index 627b8d9..0e9db11 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -1098,6 +1098,14 @@ import "github.com/duke-git/lancet/v2/random" - **RandUniqueIntSlice** : 生成一个不重复的长度为 n 的随机 int 切片。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandUniqueIntSlice)] [[play](https://go.dev/play/p/uBkRSOz73Ec)] +- **RandSymbolChar** : 生成给定长度的随机符号字符串。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandSymbolChar)] + [[play](https://go.dev/play/p/uBkRSOz73Ec)] +- **RandFloat** : 生成随机float64数字,可以指定范围和精度。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandFloat)] + [[play](https://go.dev/play/p/uBkRSOz73Ec)] +- **RandFloats** : 生成随机float64数字切片,可以指定长度,范围和精度. + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/random.md#RandFloats)]

17. retry 重试执行函数直到函数运行成功或被 context cancel。       回到目录

@@ -1341,6 +1349,9 @@ import "github.com/duke-git/lancet/v2/slice" - **Partition** : 根据给定的predicate判断函数分组切片元素。 [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Partition)] [[play](https://go.dev/play/p/lkQ3Ri2NQhV)] +- **Random** : 随机返回切片中元素以及下标, 当切片长度为0时返回下标-1。 + [[doc](https://github.com/duke-git/lancet/blob/main/docs/api/packages/slice.md#Random)] +

19. stream 流,该包仅验证简单的 stream 实现,功能有限。       回到目录

diff --git a/docs/api/packages/random.md b/docs/api/packages/random.md index 346bac5..4dddac4 100644 --- a/docs/api/packages/random.md +++ b/docs/api/packages/random.md @@ -29,6 +29,7 @@ import ( - [RandLower](#RandLower) - [RandNumeral](#RandNumeral) - [RandNumeralOrLetter](#RandNumeralOrLetter) +- [RandSymbolChar](#RandSymbolChar) - [UUIdV4](#UUIdV4) - [RandUniqueIntSlice](#RandUniqueIntSlice) - [RandFloat](#RandFloat) @@ -303,7 +304,7 @@ func main() { ### RandFloat -

生成随机float64数字,可以指定范围和精度

+

生成随机float64数字,可以指定范围和精度。

函数签名: diff --git a/docs/en/api/packages/random.md b/docs/en/api/packages/random.md index b734608..d7cabee 100644 --- a/docs/en/api/packages/random.md +++ b/docs/en/api/packages/random.md @@ -305,7 +305,7 @@ func main() { ### RandFloat -

Generate random float64 number between [min, max) with specific precision.

+

Generate a random float64 number between [min, max) with specific precision.

Signature: