Skip to content

Weight genders in faker.person.gender() #1730

@matthewmayer

Description

@matthewmayer

Clear and concise description of the problem

faker.person.gender() pulls from a list of genders at https://github.com/faker-js/faker/blob/next/src/locales/en/person/gender.ts

This is a very inclusive list, however I feel it makes the function less realistic to have all values returned with equal probability. In reality, even in fairly LGBTQ-friendly countries, the percentage of people who define as non-cis-gender is fairly low https://www.bbc.com/news/uk-64184736

Suggested solution

Now that we have faker.helpers.weightedArrayElement i think we could change this so for example it returns "Man" 45% of the time, "Woman" 45% of the time, and one of the other genders 10% of the time (divided equally between the other 73 options)

Alternative

Keep current behavior (unrealistic)
Only return Man or Woman (non-inclusive)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: refactorPR that affects the runtime behavior, but doesn't add new features or fixes bugsm: personSomething is referring to the person modules: waiting for user interestWaiting for more users interested in this feature

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions