Square line picking is the selection of pairs of points (corresponding to endpoints of a line segment) randomly placed inside a square.
random line segments can be picked in a unit square
in the Wolfram Language using the
function RandomPoint[Rectangle[],
n,
2
].
Picking two points at random from the interior of a unit square, the average distance between them is the case of hypercube line
picking, i.e.,
(1)
| |||
(2)
| |||
(3)
|
(OEIS A091505).
The exact probability function is given by
(4)
|
(M. Trott, pers. comm., Mar. 11, 2004), and the corresponding distribution function by
(5)
|
From this, the mean distance can be computed, as can the variance
of lengths,
(6)
| |||
(7)
|
The statistical median is given by the root of the quartic equation
(8)
|
which is approximately .
The th
raw moment is given for
, 4, 6, ... as 1/3, 17/90, 29/210, 187/1575, 239/207, ...
(OEIS A103304 and A103305).
If, instead of picking two points from the interior of a square, two points are chosen at random on different sides of the unit square, the average distance between two points picked in this manner is
(9)
| |||
(10)
| |||
(11)
| |||
(12)
|
(OEIS A091506; Borwein and Bailey 2003, p. 25; Borwein et al. 2004, p. 66).