Controlled Sampling / Rate-Limiting Function Executor
Implement a sampling utility that wraps any given function and ensures it executes only once every N invocations — i.e., it samples 1 out of every N calls rather than every call. This is different from debounce or throttle (which are time-based); sampling is call-count-based. The function should maintain its own internal call counter, reset correctly, and pass through all original arguments when it does fire. Bonus: support a configurable offset for which call in the N-window triggers execution.