-
-
Notifications
You must be signed in to change notification settings - Fork 953
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
Weight genders in faker.person.gender()
#1730
Comments
-> Keep current behavior (unrealistic) When someone already calls the method, they intend to get just some random data for e.g. testing an input like a gender free text field on Facebook or whatever platform. It is not meant to represent realistic data neither IMO Faker is not meant to be a real world database for everything. Implementing weight into all and everything inside Faker is a non goal to me. |
I guess it depends what you mean by "but realistic" in the tagline: Generate massive amounts of fake (but realistic) data for testing and development. i think in some cases like the name patterns, adding weights makes the data more realistic. |
I agree, that we should somewhat balance the genders. |
Workaround: faker.datatype.boolean({ probability }) ? faker.person.sex() : faker.person.gender() If you are interested in this feature, please upvote it. |
Thank you for your feature proposal. We marked it as "waiting for user interest" for now to gather some feedback from our community:
We would also like to hear about other community members' use cases for the feature to give us a better understanding of their potential implicit or explicit requirements. We will start the implementation based on:
We do this because:
|
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.tsThis 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
The text was updated successfully, but these errors were encountered: