1% Hit-and-run MCMC sampling of a 2D convex region.
2%
3% A random convex polygon is generated, then N points are drawn from the
4% uniform distribution on it with the hit-and-run algorithm: from the current
5% point, pick a random direction, find the chord where that line crosses the
6% region, and jump to a uniform-random point on the chord. Repeat. The figure
7% shows the region outline and the resulting samples.
8%
9% The region + sampling functions live in helpers/. `addpath` must be the
10% first statement (numbl resolves the driver's search path before running),
11% so it comes before everything else.
13addpath('helpers'); % make_region, hit_and_run
15rng(1); % reproducible region + samples
17hitandrun_sampler(10000); % matches the figure's default samples control