Probability distribution of the distance of a point in a square to a fixed point The question is, given a fixed point with coordinates X,Y, in a square of size N. What is the probability distribution of the distance to a random point. More specifically, what is the probability distribution of the square root of the square sum of 2 randomly independent uniform variables (0,N).
 A: To find the distribution of the distance between the origin, $(0,0)$ and a random point on the unit square $(0,1)^2$ we can integrate over the area that is within $d$ of the origin. That is, find the cdf $P(\sqrt{X^2 + Y^2} \leq d)$, then take the derivative to find the pdf. Extensions to the square $(0,N)$ are immediate.
Case 1: $ 0 \leq d \leq 1$
$$
F_{D}(d) = P(\sqrt{X^2 + Y^2} \leq d) = P(X^2 + Y^2 \leq d^2) \\
= \int_{0}^{d} \int_{0}^{\sqrt{d^2-x^2}}1dydx \\
= \int_{0}^{d} \sqrt{d^2 - x^2}dx\\
= \frac{d^2\pi}{4}
$$
Case 2: $1 \leq d \leq \sqrt{2}$
$$
F_{D}(d) = \int_{0}^{\sqrt{d^2 - 1}} 1 dx + \int_{\sqrt{d^2 - 1}}^{1}\int_{0}^{\sqrt{d^2-x^2}}1dydx \\
=\sqrt{d^2-1} + \int_{\sqrt{d^2-1}}^{1}\sqrt{d^2-x^2}dx\\
= \sqrt{d^2 -1} + \frac{1}{2}\left\{t\sqrt{d^2-t^2}+d^2\tan^{-1}\left(\frac{t}{\sqrt{d^2-t^2}}\right) \right\}|_{\sqrt{d^2-1}}^{1} \\
= \sqrt{d^2-1} + \frac{1}{2}\left\{\sqrt{d^2-1}+d^2\tan^{-1}\left(\frac{1}{\sqrt{d^2-1}}\right) - \sqrt{d^2-1}\sqrt{1}-d^2\tan^{-1}\left(\frac{\sqrt{d^2-1}}{1}\right)\right\} \\
=\sqrt{d^2-1} + \frac{d^2}{2}\left\{ \tan^{-1}\left(\frac{1}{\sqrt{d^2-1}}\right)-\tan^{-1}\left(\sqrt{d^2-1}\right)\right\}
$$
Taking the derivative gives the density
$$
f_{D}(d) = \frac{d\pi}{2}, 0 \leq d \leq 1\\
f_{D}(d) = d\left\{\tan^{-1}\left(\frac{1}{\sqrt{d^2-1}}\right)-\tan^{-1}(\sqrt{d^2-1})\right\}, 1 \leq d \leq \sqrt{2} \\
$$
Comparing the result with @BruceET's simulation answer on Expected average distance from a random point in a square to a corner, we find it matches exactly.
den <- function(d) {
  if(d < 0) {
    return(0)
  }
  if(d < 1) {
    return(d*pi/2)
  }
  if(d < sqrt(2)) {
    return(d*(atan(1/sqrt(d^2-1)) - atan(sqrt(d^2-1))))
  }
  if(d > sqrt(2)) {
    return(0)
  }
  stop()
}
ys <- xs <- seq(from=0,t=1.42,by=0.01)
for(i in seq_along(xs)){
  ys[i] <- den(xs[i])
}

set.seed(2021)
x = runif(10^6);  y = runif(10^6)
d = sqrt(x^2 + y^2)
hist(d, prob=T, br=seq(0,1.42,0.02),xlim=c(0,1.5),ylim=c(0,1.5))
lines(xs,ys,col="red",lwd=2)


Created on 2021-06-15 by the reprex package (v2.0.0)
By symmetry this is equal to the distance between random points and $(0,1)$, $(1,0)$, and $(1,1)$. Finding the distance to a point on the boundary or the interior of the square will require considering more cases in the cumulative probability function.
