Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

random.random()方法始终返回n个a或者n个0 #265

Open
coder-liyang opened this issue Nov 11, 2024 · 1 comment
Open

random.random()方法始终返回n个a或者n个0 #265

coder-liyang opened this issue Nov 11, 2024 · 1 comment

Comments

@coder-liyang
Copy link
Contributor

RandString(),RandNumeral()等方法的底层方法都是random(),不知道什么原因引起的,从某一刻起,随机出来的内容就固定了,随机字符串就固定是n个a,随机数字就固定是n个0,重新build一下就又没问题了.
图片
图片

@duke-git
Copy link
Owner

@coder-liyang 应该是调用random前,随机数种子没有变化,这个后续会修复。临时方案是调用RandString(),RandNumeral()等方法前加上rand.Seed(time.Now().UnixNano())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants