-
Notifications
You must be signed in to change notification settings - Fork 56
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
Less errors in RandomBits
methods
#534
Comments
Is there a use case where this would actually make sense? Otherwise it seems like an error condition to me |
In any use case where the user generalizes on |
But in particular I'm asking about miscomputing the size and causing the error case. Why is it being miscomputed? Why is it being passed explicitly instead of inferred? |
Because |
But more specifically, what is an example of a case where |
I admit I don't have a specific example in mind, I see it as more of a quality of life improvement — the general principle being, when it's possible, instead of an error do something that doesn't lead to incorrect behavior. |
Shouldn't the answer for those cases be "use |
A possible change of contract of
RandomBits
that can eliminate some error/panic cases: in the methods that takebits_precision
, treat it asat_least_bits_precision
inBoxedUint
. That is ifRandomBits::random_bits_with_precision()
is called withbits_precision == 128
forU256
, it will returnU256
instead of panicking. Or is that too dynamic?The text was updated successfully, but these errors were encountered: