You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I might be misunderstanding the purpose of Distribution::sample_iter, in which case feel free to close this issue.
Best I can tell, the Distribution::sample_iter function is not useful. Implementations of the Distribution trait are required to still return a DistIter struct, which means that the only sensible implementation of Distribution::sample_iter is to use the default implementation.
So we might as well move the implementation of Distribution::sample_iter into Rng::sample_iter and get rid of Distribution::sample_iter.
This is arguably somewhat similar to issue 451, in that we currently have two ways of creating an iterator, Uniform::new(1, 30).sample_iter(rng) and rng.sample_iter(Uniform::new(1, 30)), whereas it seems having one would be better.
I'm happy to create a pull request if there's agreement.
The text was updated successfully, but these errors were encountered:
You mean not useful the way functions like Iterator::count are trivial to implement and have no sensible implementation besides the default? Or just because there are two functions for the same thing?
I agree with @pitdicker, in part because of symmetry with Rng::sample and Distribution::sample. It's weird for sure, but there's isn't really a good alternative I don't think (even the old Rand could be used in two ways).
I might be misunderstanding the purpose of
Distribution::sample_iter
, in which case feel free to close this issue.Best I can tell, the
Distribution::sample_iter
function is not useful. Implementations of theDistribution
trait are required to still return aDistIter
struct, which means that the only sensible implementation ofDistribution::sample_iter
is to use the default implementation.So we might as well move the implementation of
Distribution::sample_iter
intoRng::sample_iter
and get rid ofDistribution::sample_iter
.This is arguably somewhat similar to issue 451, in that we currently have two ways of creating an iterator,
Uniform::new(1, 30).sample_iter(rng)
andrng.sample_iter(Uniform::new(1, 30))
, whereas it seems having one would be better.I'm happy to create a pull request if there's agreement.
The text was updated successfully, but these errors were encountered: