Skip to content

Random number generator unreliable #72

Open
@noneymous

Description

@noneymous

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions