I have a line of $n$ $0$'s like this:
Zeroth index -->$000...000$
I want to populate the line with $m$ $1$'s with the following rules:
(1) They have to occur after the index $i_{\text{start}_n}$ and before the index $i_{\text{end}_n}$.
(2) There must be at least three $0$'s between any two $1$'s.
(3) The positions are random within the above two constraints.
(4) $i_{\text{start}_n}<i_{\text{end}_n}<n-1$
(5) $\color{red}{m<?}$
How can this insertion be performed, and what are the constraints on $\color{red}{m}$?
Attach a zero to each side of each $1$, then insert the $m$ "$010$" units into a line of $(n-2m)$ zeroes (including potentially before and after).
This is possible in ${n-2m+1 \choose m}$ ways.
Clearly we need $(n-2m+1) \ge m \implies m \le \frac{n+1}{3}$
Algorithmically, finding positions for the $m$ $1$s can use the above insertion process as follows: