-
-
Notifications
You must be signed in to change notification settings - Fork 939
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
Allow passing precision to faker.number.int #2186
Comments
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:
|
Related: #1596 In that issue we already approved the step feature. I keep this issue open because it is explicitly for the step feature. |
Workaround: |
Are you willing to create a PR for this? |
Sure I can have a look |
Note that the step feature in #1596 was for float, not for int. If we do it for one we should probably do it for all number methods. |
Im still a bit dubious about how useful this parameter is in reality versus just multiplying by a constant as in the workaround posted by @SD-DDT . To get a number between 30 and 200, with an increment of 10 can be clearly described by But this call requires looking at the documentation to see if you will get a) {10,20,30,40,50} or b) {5,15,25,35,45} I'd rather write those two options more explicitly as:
|
After reading your comments, I did a new PR with a step param. It feels more natural than precision, so I think we should go with that. |
I previously argued for a name something like 'multipleOf' to make it clear it doesn't work in the same way as say the HTML input element |
Any progress on this? |
Could you address the comments in the open PR: #2188 (comment) |
This issue has been resolved by #2586 and was released as part of https://github.com/faker-js/faker/releases/tag/v9.0.0-alpha.0. |
Clear and concise description of the problem
In faker 7 I could specify
to get a number between 30 and 200, with an increment of 10, so: 140, 90, 180, ...
But with faker 8, the precision was removed from int.
Suggested solution
Allow passing a precision to the int faker function
Alternative
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: