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

get_random_str,当随机串长度大于样本时会发生 ValueError #115

Closed
mindjun opened this issue Sep 23, 2018 · 0 comments
Closed
Labels
Milestone

Comments

@mindjun
Copy link
Contributor

mindjun commented Sep 23, 2018

背景

  • 函数 get_random_str,根据random.sample来获取随机字符串,当需要获取的随机串大于随机源时会报错,参考random.sample源码:
 if not 0 <= k <= n:
    raise ValueError("Sample larger than population or is negative")

解决

  • 添加逻辑,当需要获取的随机串长度过大时,也增加随机源的长度
@mindjun mindjun added the bug label Sep 23, 2018
@mindjun mindjun added this to the v1.1.1 milestone Sep 23, 2018
@itaa itaa modified the milestones: v1.1.1, v1.1.2 Oct 12, 2018
@mindjun mindjun closed this as completed Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants