Generating Random Samples

My notes on probability are scattered here and there.
First, a Random number generator in Scheme.

When we have a probability distribution we can propose a program that generates random samples from that distribution. Here are some pointers to such programs, mainly on this site. First some notation:

To choose a point in a sphere {(x, y, z)| xx+yy+zz < 1}, put a cube [−1, 1]3 around the sphere, choose 3 samples from U[−1, 1] and use those to define a point in the cube. Keep this up until you find one also in the sphere.

This works fine in 2D, 3D and 4D but becomes inefficient for greater dimensions. For k dimensions form a vector V with k components, each chosen from N(0, 1). Normalize V. (Divide V by its length.) That selects a random point on Sk−1, the surface of the k dimensional ball. If you want a random point within the ball multiply V by X1/k where X is drawn from U(0, 1).

Here is how to choose a Random Normal Deviate from N(0, 1).

Random point in Simplex

Lambertian Reflection describes how photons and particles rebound from a rough surface.

Groups

Here are two invariant distributions over a group, the 1st discrete and the 2nd continuous.
Random Permutation in C
Random Orthogonal Matrices
Constructing a Brownian Function
Most of these cases involve a group on the space to be sampled. Often it is natural to specify that some measure is invariant under that group. Such cases have a geometric flavor. The Cumulative Distribution Function (CDF)
Copula
Distribution of products of two samples from U(0, 1).
White

Bertrand’s ‘Paradox’