How to calculate the probability of drawing numbers under certain constraints We have numbers $1,2,3,\dots, n$, where $n$ is an integer, and we select $d$ distinct numbers from them, $i_1,i_2,\dots,i_d$. What is the probability that there exist at least two numbers whose difference is less than $k$, i.e $|i_{h}-i_{j}|<k$, for any $h,j \in \{1,2,3,\dots,d\}$
I am thinking about the total number which satisfies the constraint should be $(n-k+1)(k-1)\binom{n-2}{d-2}$, and the total number is $\binom{n}{d}$,
so the answer should be $\dfrac{(n-k+1)(k-1)\binom{n-2}{d-2}}{\binom{n}{d}}$
Thank you in advance
 A: I think the best approach is to enumerate the number of ways to choose $d$ numbers so that the difference between any two is at least $k$.  That is, we aim to enumerate the number of sets of the form $\{i_1,i_2,\ldots,i_d\}$ such that $|i_j-i_{j-1}|\geq k$ for all $2\leq j\leq d$.
One way to think about this type of problem is via 'stars' and 'bars'.  For example, if $n=7$, $d=3$, and $k=2$ we can consider $**|**|**|*$ to represent the set $\{2,4,6\}$.  Note that each 'bar' represents a number corresponding to the number of stars that come before it.  Notice also that, in order to satisfy the condition that the difference between any two numbers is 2 or greater, we need at least two 'stars' between each bar.
We can come up with the general result using the above observations.  we are choosing $d$ numbers, so we need $d$ bars.  The difference between each consecutive number in our set must be at least $k$, so we need at least $k$ stars between each consecutive pair of bars.  Think of the bars as dividers between bins.  there are $d$ bars, so there are $d+1$ bins.
$$\text{-bin 1-}|\text{-bin 2-}|\cdots|\text{-bin $d+1$-}$$
By our above logic, bins 2 through $d$ must contain at least $k$ stars and bin 1 must contain at least 1 star.  So the number of ways to choose $d$ numbers with pairwise difference at least $k$ amounts to enumerating how many ways we can place the rest of the stars into bins.  We have $k\cdot(d-1)+1$ stars already placed, leaving $n-k(d-1)-1$ stars to be placed in the $d+1$ bins available.
Let $m=n-k(d-1)-1$ and $e=d+1$.  So the question becomes, how many ways are there to place $m$ stars into $e$ bins?  We can answer this question by placing $e-1=d$ dividers anywhere between $m$ stars.  In this scenario the total number of spots for stars or bars is $m+d$ and we are choosing $d$ of them to be bars.  So there are $\binom{m+d}{d}=\binom{n-k(d-1)-1+d}{d}=\binom{n+k+d-kd-1}{d}.$
So the probability you are looking for is
$$1-\frac{\binom{n+k+d-kd-1}{d}}{\binom{n}{d}}=\frac{\binom{n}{d}-\binom{n+k+d-kd-1}{d}}{\binom{n}{d}}.$$
A: Comment.
For, $n = 52,\;  d = 5,\;  k = 3,\;$ I get 
 (n-k+1)*choose(k,2)*choose(n-2,d-2)/choose(n,d)
 ## 1.131222

which is not a probability. So it seems there is an error somewhere.
[OP now edited. Answer is now a probability, and disagrees with
simulation below and @Eric's Answer. OK for $\le k$.]
 (n-k+1)*(k-1)*choose(n-2,d-2)/choose(n,d)
 ## 0.7541478

In case it helps, I simulated this particular version of the
experiment 100,000 times using R statistical software, with the following results--accurate
to roughly two places. I hope having approximate answers as a
reality check will be useful to you or someone else in deriving
an analytic solution.
 m = 10^5;  n = 52;  d = 5;  k = 3;  x = numeric(m)
 for(i in 1:m) {
   s = sample(1:n, d)
  x[i] = sum(diff(sort(s)) < k) }
 mean(x >= 1)
 ##  0.58428  # approx prob at least one 'small diff'

Here are a couple of individual runs, as a proof of concept for the simulation:
 s = sample(1:n, d);  s
 ##  8 27 32 10 29
 sort(s)
 ##  8 10 27 29 32
 diff(sort(s))
 ##  2 17  2  3
 sum(diff(sort(s)) < k)
 ##  2

 s = sample(1:n, d);  s
 ##  9 25 21 50 30
 sort(s)
 ##  9 21 25 30 50
 diff(sort(s))
 ##  12  4  5 20
 sum(diff(sort(s)) < k)
 ## 0

Addendum: Here is @Eric's formula for this particular case:
 num = choose(n,d) - choose(n + k + d - k*d - 1, d)
 den = choose(n,d)
 num/den
 ## 0.5821375  # Above agrees with this within simulation error

