Closed ST-DDT closed 11 months ago
It seems to be the usual behaviour for a random number generator generating values between 0 (included) and 1 (not included). For instance, Math.random
does exactly the same.
Then the problem is all our other methods such as faker.number.int that do generate the max value? What do you think?
Yeah, I came to the same conclusion as @dubzzz
It is very unusual that you every need a 1.0
, it is always 0.0
inclusive to 1.0
exclusive.
Now as I worked a little bit with #2379 and also had a look into https://www.npmjs.com/package/pure-rand, I'm more and more of the opinion that a 1.0
inclusive is not wanted at all and if our number.float
allows an inclusive max, then maybe we need to change that or find a real reason why it is that way.
I didn't head an eye on that until now, because I was always just interested in some fake data and not scientific correct accurate numbers. Just like give me any value between 0
and 1
, I don't care if it ever bulls-eye 0.0
, 0.5
or 1.0
exactly.
Ints are fine to have inclusive max.
But floats intuitively don't.
What about our faker.number.float() method with precision?
Team Decision:
Works as expected We need to enhance our documentation for that
Pre-Checks
Describe the bug
faker.number.float() is unable to return 1.
Minimal reproduction code
Additional Context
Originally part of:
Environment Info
Which module system do you use?
Used Package Manager
pnpm