Lets say I have an array of length n
and I want to pick k
values from it, evenly, starting from 0. If k
divides n
, then this would be easy, but if k
does not divide n
, then I need to vary the value m
I increment the array pointer with. How would you do this?
For example, if m=1.5
then I want to pick the following numbers:
var arr = array(0,1,2,3,4,5,6,7,8);
arr.every(1.5);
//returns 0,1,3,4,6,7
I don't need to know what happens if k
is larger than n