Added numberBetween for doubles.
PR Summary
-
Modification of the 'numberBetween' method The method for generating a random number within a given range has been updated. It is now more flexible and easier to modify in the future.
-
Addition of a new 'numberBetween' method A new version of the method for generating a random number has been created. This one accommodates decimal numbers between set boundaries, extending usability for calculations requiring more precision.
-
Improving the testing structure To secure the efficiency and accuracy of the new method, a special test has been integrated into our regular testing sequence. It safeguards that the generated decimal numbers actually do fall into their prescribed range. This guarantees reliable results for future calculations.
https://github.com/datafaker-net/datafaker/blob/12bdd2af5d3e0deae8287b916d82769f07e190ed/src/test/java/net/datafaker/FakerTest.java#L211-L215
numberBetweenRepeated
Interesting. What should we do with this? I think what I'm basically asking is:
"#{number.number_between '1','10'}", should/could that return 1.5?
Yes in this case it could be.
Yes in this case it could be.
I agree. I'm just not sure if that's going to break anything. Probably not likely, but not sure. Any suggestions on what to do here? Reject the PR, fix the test, something else?
I see two options.
- Adjust the regex
- Make the double method specific instead of
numberBetweenmaybedoubleBetween.
@kingthorin
Adjust the regex
I did.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 92.06%. Comparing base (
87a3803) to head (59c4c7c).
Additional details and impacted files
@@ Coverage Diff @@
## main #1392 +/- ##
============================================
- Coverage 92.26% 92.06% -0.20%
+ Complexity 3166 3157 -9
============================================
Files 320 320
Lines 6177 6178 +1
Branches 592 592
============================================
- Hits 5699 5688 -11
- Misses 335 344 +9
- Partials 143 146 +3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.