goutil icon indicating copy to clipboard operation
goutil copied to clipboard

Function RandomChars has bug

Open cos800 opened this issue 2 years ago • 4 comments

System (please complete the following information):

  • OS: windows
  • GO Version: 1.19
  • Pkg Version: v0.6.12

Describe the bug

Always get string like this: jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjpp, 11111eeeeeeeeeeeeeeeeeeeeeeeeeee

To Reproduce Here is my code:

func TestRandStr(t *testing.T) {
	a := strutil.RandomCharsV2(32)
	t.Log(a)
}

Screenshots

image

cos800 avatar Aug 16 '23 10:08 cos800

hi @cos800 on my machine(macOS):

image

inhere avatar Aug 31 '23 06:08 inhere

好像是在 Windows 下有问题,随机数出来的重复了。

inhere avatar Sep 08 '23 07:09 inhere

我暂时也没找到解决办法。 rand 包好像在Windows下有BUG

inhere avatar Oct 13 '23 11:10 inhere

我暂时也没找到解决办法。 rand 包好像在Windows下有BUG

可以看下我的提交https://github.com/gookit/goutil/pull/154

pigwantacat avatar Jan 27 '24 14:01 pigwantacat