algorithm - Selecting items from events, as evenly spaced as possible -
If I have an event that is 15 times a second (numbered 1 - 15), but I only process it Wish 3 times I can choose [1], [6] and [11],
. It is important that the procedure that I take, is as equally as possible and wrap the account-around, ie events are consistently 13, 14, 15, 1, 2, 3 etc.
If I want to do the 4 best items I can do, [1], [5], [9] and amp; [13] .
Is there a general algorithm that calculates which events let me count the total number of events ( total
) and the number of processed ( processAmount
).
You can try to use this basic approach - for the partition equal non-integer parts Take the nearest integer event index for your interval and each event:
int gaps = total + 1; Double Phase = 1.0 * Interval / Processing Amount; For (int i = 0; i
Comments
Post a Comment