-
Notifications
You must be signed in to change notification settings - Fork 22
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
float only returns number between 0 and 1 #63
Comments
I can't speak to whether this is a bug or not. But I think the current behavior would a reasonable default for this generator. |
@Stratus3D I am not sure if I understand you correctly, do you want to keep this behavior? I think it is not expected that float return floats in a range instead of any float as integer does. |
I guess I'm not sure how we would generate floats of infinite size. Although apparently it is possible. The Erlang library I'm familiar with generates floats with a range of infinity to infinity (https://proper-testing.github.io/apidocs/proper_types.html#float-2). |
I agree that |
It's fine to have a generator that only produces values in the range |
By the way, the original QuickCheck implementation in Haskell defines floats in a way similar to this Ruby equivalent:
(where |
Not sure if this is helpful more than a year later, but in case anyone else comes across this, you can do math in in Rantly blocks on the property methods. It's easy to use this >> Rantly(4) { range(3, 10) * float }
=> [3.3218256844886724, 4.588350561344799, 4.528890728138369, 1.6470508044388694] As far as readability goes, I think this is quite clear. |
Rantly { float } #=> a float between 0 and 1
I think this is not expected and it should return higher floats as well. 🤔
The text was updated successfully, but these errors were encountered: