# Random point distribtion

How to generate numerically a set of random points $(x_1,y_1), (x_2,y_2),\cdots, (x_N,y_N)$ such that the pair-wise distances

$d = \sqrt { (x_i-x_j)^2 + (y_i-y_j)^2}$, for all $0<i\le N, 0<j\le N$

satisfy some given distribution $P(d)$ (e.g., Gaussian, exponential, etc.).

• Interesting question - where is it from? – nbubis Dec 17 '13 at 6:58
• Also note that the distribution of distances can never be Gaussian, since $d>0$ :) – nbubis Dec 17 '13 at 6:59
• If you want to exclude $i=j$ then it might be neater to write $1 \le i \lt j \le N$ – Henry Dec 17 '13 at 8:04
• The question is from mixing two components, e.g., fine particles in the air; stars distribution in the universe, etc. I distilled it into this general form. The question may not be well posed but to me it made some sense. – user43286 Dec 17 '13 at 17:53
• Yes, the number of samples is usually large. – user43286 Dec 17 '13 at 21:50

If you sample all Points independently from a fixed spatial Distribution with density $g:\mathbb R^2 \to [0,\infty)$ then every two distinct Points have the same distance Distribution. Now if $F$ is the cumulative density function of the Distribution $P(d)$, it will have to solve the following equation $$F(r) = \mathbb P(\|x_1-x_2\|_2 \leq r) = \int_{\mathbb R^2} \int_{B_r(x_1)} g(x_1) g(x_2) dx_2 dx_1 = \int_{\mathbb R^2} g(x) (g \ast \mathbf 1_{B_r})(x) dx.$$ Here $B_r(x)$ is the Ball around $x$ with radius $r$. Now this is some Kind of integral equation, which to solve numerically is another question in the numerics section.