-
Notifications
You must be signed in to change notification settings - Fork 72
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
characters are not generated uniformly #15
Comments
I would totally merge this if you had a working fork 😉 |
dchest
added a commit
to dchest/node-randomstring
that referenced
this issue
Feb 12, 2016
Add tests for unique and unbiased strings. Closes klughammer#15
dchest
added a commit
to dchest/node-randomstring
that referenced
this issue
Feb 12, 2016
Add tests for unique and unbiased strings. Closes klughammer#15
Merged
👍 |
I tested this function wise and it works. Could anyone check whether characters now are really generated uniformly? |
@eliaskg there's a test for uniformness included: dchest@15ce2fd#diff-910eb6f57886ca16c136101fb1699231R79 If you want to see/graph the distribution, insert a few |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
numbers 0-7 are generated more often then other characters. Because the number of characters is 62. The random number from generator is 0-255. 256 is not multiple of 62.
You should replace
with something like this:
to throw away the nonuniform remainder
The text was updated successfully, but these errors were encountered: