-
Notifications
You must be signed in to change notification settings - Fork 323
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
feat(random): Adds a function that generates a random floating-point number between the minimum and maximum. #53
Conversation
@sossost is attempting to deploy a commit to the Toss Team on Vercel. A member of the Team first needs to authorize it. |
Hello, thanks for your contribution! This is a great pull request. Meanwhile, I think the result of if (minimum > maximum) {
throw new Error("The maximum value must be greater than the minimum value.");
} |
Good opeanion, it's more consistent and clear than the old way. I've updated the code in that direction. Minimum (inclusive) maximum (exclusive), so for consistency, it will also throw an exception if the minimum and maximum are the same. if (minimum >= maximum) {
throw new Error('Invalid input: The maximum value must be greater than the minimum value.');
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your great contribution!
Thanks too! |
close #51
I have added a function to generate a random floating point number between the minimum and maximum values input.
Below is a screenshot of the benchmark.
If the min and max are the same, it's returning the min value, just like lodash, but I don't know which is better, throwing an exception or not.
I'll also be working on the randomInt function based on feedback from this PR.