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 number generator unreliable #72

Open
noneymous opened this issue Mar 19, 2021 · 0 comments
Open

Random number generator unreliable #72

noneymous opened this issue Mar 19, 2021 · 0 comments

Comments

@noneymous
Copy link

noneymous commented Mar 19, 2021

Hi,

I've seen you are using math/rand, which causes diversity and gender quota issues ;-)

  • I often ended up with the same gender
  • I often had collisions, with the same names being chosen in a row

I suggest changing random number generation from

		import "math/rand"

		// ...

		g := rand.Intn(2)

to

		import "crypto/rand"

		// ...

		n, _ := rand.Int(rand.Reader, big.NewInt(2))
		g := int(n.Int64())

(Respectively, something similar in func randomFrom(...))

I could mitigate the gender selection by generating the random number myself, but the name for that gender is then still decided by internals and not properly random, often causing the same name in a row.

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

1 participant