Function itertools::linspace [] [src]

pub fn linspace<F>(a: F, b: F, n: usize) -> Linspace<F> where F: Copy + Sub<Output=F> + Div<Output=F>, usize: ToFloat<F>

Return an iterator with n elements, where the first element is a and the last element is b.

Iterator element type is F.

use itertools as it;
let mut xs = it::linspace::<f32>(0., 1., 5);
assert_eq!(xs.collect::<Vec<_>>(),
           vec![0., 0.25, 0.5, 0.75, 1.0]);