-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
randFloat
with equal min/max results in RangeError: Maximum call stack size exceeded
#361
Comments
@soanvig Well, generally speaking, this is kind of a misuse, but I do agree that this shouldn't result in a stack overflow. |
@shaharkazaz this is definitely not misuse. Min/max range is inclusive. Therefore |
@soanvig can you share your use case where you use a random range function where the minimum and maximum are the same and not just use the value itself? From the use cases I've encountered with Falso I never needed anything like that that's why I'm asking :) |
I don't see the reason to give the use case, because that's clearly a bug if there is inconsistency in how Falso works. I use
I have nothing against |
It's okay to have a conversation over things, I find the tone of your comment a bit aggressive even though there is no real reason for it. you could have just dropped the intro and written whatever you wrote anyway, I was just interested in your use case. You and I both want to make this OS better. You are welcome to open a PR to support use cases where the min & max inputs are equal and return this value, make sure you make the change across all functions (if we have any more cases like this) |
@shaharkazaz don't worry, I'm never aggressive. After all I answered the question. It's just I feel that the if there is a bug (I think we all agree incosistency is a bug), there is a bug, and talking about use cases dilutes the conversation and diverges from the main topic. Probably if you answered "yeah, that's OK if you open PR", and then asked about use cases out of curiosity, then I wouldn't add that line. That's all :) I plan to send PR in 2 weeks then. |
Is this a regression?
No
Description
If I call
randFloat({ min: 0, max: 0 })
I get maximum call stack size exceeded error.This should result in
0
, since0
satisfiesmin
andmax
requirements.Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Note I'm using yarn PnP
Please provide the environment you discovered this bug in
No response
Anything else?
No response
Do you want to create a pull request?
Yes
The text was updated successfully, but these errors were encountered: