so situation face this:
i'm rendering graph, each entry add decreases load time. want graph use maximum of 100 entries, amount of entries have variable.
so lets have 500 entries available graph. 100 of them should added graph, distributed evenly (so e1, e6, e11, e16 ... e496). if have less entries 100, should use entries have.
so:
500 -> 100 150 -> 100 50 -> 50 10 -> 10
what formula/loop should use determine entries selected graph?
this should either job or @ least give head start:
fun reduce(list list, int maxlen) : list { int skip = list.length > maxlen ? list.length / maxlen : 1; list r = new list(); for(int i=0; i<list.length; i+=skip){ r.add( list[i] ) } return r; }
list listof100 = reduce( abiglist, 100 );