I have an set of input ranges {[a1, b1], [a2, b2], ...}. Each a and b represent integer values.
I have a constant "segment length" i that is always less than b-a for all a and b.
I would like to uniformly sample (either with or without replacement) from the input ranges to get a set of subranges that fall within those inputs.
My naive approach is to expand the inputs to a larger set:
{
[a1, a1 + i],
[a1 + 1, a1 + i + 1],
...
[b1 - i, b1],
[a2, a2 + i],
...
[b2 - i, b2],
...
}
and then sample from this. This would be a pretty memory-exhaustive approach. I also need to deal with duplicate elements. Is there a smarter way to subsample?