-
-
Notifications
You must be signed in to change notification settings - Fork 476
Description
The Rng
trait has the gen_iter()
function which creates an iterator producing an infinite numbers of random numbers. It is then easy to manipulate the the iterator and generate vectors of random numbers.
Is there a reason why the various distributions do not implement this? In my particular case, I am needing to create vectors of numbers distributed normally and there is no easy way of doing that. One can't use vec![normal.ind_sample(rng); len];
because it evaluates the function once and then clones the result.
I am quite happy to implement this in this crate (if people are interested). I was thinking of maybe adding gen_iter<R: Rng>(&mut self, rng: &mut R)
and gen_ind_iter<R: Rng>(&mut self, rng: &mut R)
under Sample
and IndependentSample
respectively.