2 restaurants located randomly any help on following question will be much appreciated.
Q. Suppose that $2$ restaurants are going to be located at a street that is $10$ km long. The location of each restaurant is chosen randomly. What is the probability that they will be located less than $5$ km apart?
Ans: $\frac 34$
Also, can we generalize this to "probability of $2$ entities located randomly over $y$ km stretch such that they are $x$ km apart"?? 
 A: A "quick and easy" route:
Think of it as placing one restaurant first and then seeing where you can place the next.
The two extremes are when you place the first restaurant in the middle (where the probability of a randomly selected position being within $5$ km is $1$) and then the first restaurant is at the edge (where the probability is $\frac{1}{2}$).
As you change the position from these two extremes, the change in the probability is linear (convince yourself if you haven't already), so you may simply take the average of the two, which is $\frac{3}{4}$.
N.B. This is obviously not the best solution, but I suspect this is from a "give a number answer" math competition, where time is key and answers like this are good enough (since work is not graded).
A: Consider a point chosen randomly in $[0,10]^2$. We want to find the area of the
points satisfying $|x-y| \le 5$ for $(x,y) \in [0,10]^2$.
If you'll excuse the rude drawing, you can see that the set of satisfying points takes ${3\over 4}$ of the area.

The answer to your other question is similar, but doesn't have the convenient fact that $5 = {1 \over 2} 10$ :-).
A: 
S1=10*10=100
S2=75
p=75/100=3/4
