As part of a more complex algorithm, I need a fast method to find random points of the n-sphere, $S^n$, starting with a RNG (random number generator). A simple way to do this (in low dimensions at least) is to select a random point of the (n+1)-ball and normalize it. And to get a random point of the (n+1)-ball select a random point of the (n+1)-cube $[-1,1]^{n+1}$ (by selecting (n+1) points of $[0,1)$ with the RNG and scaling using $x \mapsto 2x-1$) and then use "rejection", i.e., just ignore a point if it is not in the (n+1)-ball. This works fine if n is reasonably small, however for large n the volume of the ball is such a tiny fraction of the volume of the cube that rejection is enormously inefficient. So what is a good alternative approach.
[Math] a good method to find random points on the n-sphere when n is large
algorithmsmg.metric-geometrypr.probability
Related Solutions
These knots seem to be called billiard knots in the literature. They coincide with Lissajous knots as shown by Jones and Przytycki in "Lissajous knots and billiard knots", Banach center Publications 42, 145-163 (1998). Lissajous knots are knots admitting a parametrization of the form $(\cos(n_x t + d_x), \cos(n_y t + d_y), \cos(n_z t + d_z))$. There are strong constraints on such knots (see the wikipedia), and for example no torus knot can be Lissajous.
I've gained some new perspective on this question, based partly on comments and on Hitachi Peach's answer. Instead of editing the original question, I'll write down some more thoughts as a (partial) answer in the hopes that it will inspire someone with different expertise to say more.
First, after Hitachi Peach's comment following his answer, I tried plotting a picture of all the answers for a couple two of the simplest situations: quadratics and cubics with a small value of $C$.
Below is a diagram in the coefficient space for quadratic polynomials. The horizontal axis is the coefficient of $x$ and the vertical axis is the constant.
alt text http://dl.dropbox.com/u/5390048/QuadraticSmallPerron.jpg
The unshaded area in the middle are polynomials whose roots are real with maximum absolute value 5 and minimum absolute value 1; the left half of this area consists of Perron polynomials. The red lines are level curves of the maximum root.
Here is a similar plot for cubic polynomials, this time showing the region in coefficient space where all roots have absolute value less than 2.
alt text http://dl.dropbox.com/u/5390048/CubicRootsSmaller2.jpg
Among these are 31 Perron polynomials (where the maximum is attained for a positive real root. Here are their roots, and the normalized roots (divided by the Perron number):
alt text http://dl.dropbox.com/u/5390048/PerronPoints3%282%29.jpg
alt text http://dl.dropbox.com/u/5390048/PerronPoints3%282%29normalized.jpg
After seeing and thinking about these pictures, it became clear that for polynomials with roots bounded by $C > 1$, as the degree grows large, the volume in coefficient space grows large quite quickly with degree, and appears to high volume/(area of boundary) ratio. The typical coefficients become large, and most of the roots seem to change slowly as the coefficients change, so you don't bump into the boundary too easily. If so, then to get a random lattice point within this volume, it should work fairly well to first find a random point chosen uniformly in coefficient space, and then move to the nearest lattice point.
With that in mind, I tried to guess the distribution of roots (invariant by complex conjugation), choose a random sample of $d$ elements chosen independently from this distribution, generate the polynomial with real coefficients having those roots, round off the coefficients to the nearest integer, and looking at the resulting roots. To my surprise, many of the roots were not very stable: the nearest integral polynomial usually ended up with roots fairly far out of bounds, for any parameter values of several distributions I tried. (Note: one constraint on the distribution is that the geometric mean of absolute values must be an integer $\ge 1$. This rules out the uniform distribution at least for small values of $C$).
After thinking harder about the stability question for roots (as the coefficients are perturbed), I realized the importance of the interactions of nearby roots. Whenever there is a double root, the roots move quickly when coefficients are changed --- i.e., the ratio of volume in coefficient space to volume in root space is relatively small. It's as if nearby roots in effect have a repulsive force. The joint distribution of roots is important: you get wrong answers if you treat them as independent.
With this in mind, I tried an experiment where I clicked on a diagram to put in roots for a controlling real polynomial by hand, while the computer found the roots of the nearest polynomial with integer coefficients. With a little practice, this worked well. New roots "prefer" to be inserted where the existing polynomial is high, so I shaded the diagram by absolute value of the polynomial, to indicate good places for a new root. Sometimes, roots of the controlling polynomial become disassociated from roots of the nearest integer polynomial, and the result is often an out-of-bounds root not near any controlling root. In that case, deleting control roots that are disassociated brings it back into line. As the control roots are moved around, the algebraic integers jump in discrete steps, and these steps are much smaller when the control root distribution is in a good region of the parameter space.
Here's a screen shot from the experiment, (which is fun!):
alt text http://dl.dropbox.com/u/5390048/ControlRoots.jpg
Here, the convention is that each control point above the real axis is duplicated with its complex conjugate. Each control point below the real axis is projected to the real axis, and gives a real root for the control polynomial. All the control roots are shown in black, and the roots of the nearest integer polynomial are shown in red. For these positions, the red roots are nicely associated with black roots. It is a Perron polynomial, because a real root has been dragged so that it has maximum modulus.
In the next screenshot, I have dragged several control roots into a cluster around 11 o'clock. The red roots weren't happy there, so they disassociated from the control roots and scattered off in different directions, one of them out to a much larger radius. This is a good indication that the ratio of coefficient-space volume to root-space volume is small. This polynomial is not Perron.
alt text http://dl.dropbox.com/u/5390048/RootPerturb-disassociated.jpg
This experiment is much trickier for $C$ close to $1$: the coefficients are much smaller for a given degree, which makes the roots much less stable. They become more stable when there are lots of roots spread out fairly evenly, mostly near the outer boundary.
Here is one method that in principle should give a nearly uniformly-random choice of a polynomial with roots bounded by $C$, and I think, by approximating with the nearest polynomial having integer coefficients, give a nearly uniform choice of algebraic integer whose conjugates are bounded by $C$: Start from any polynomial whose roots are bounded by $C$, for instance, a cyclotomic polynomial. Choose a random vector in coefficient space, and follow a $C^1$ curve whose tangent vector evolves by Brownian motion on the unit sphere. Whenever a root hits the circle of radius $C$, choose a new random direction in which the root decreases in absolute value (i.e, use diffuse scattering on the surfaces). The distribution of positions should converge to the uniform distribution in the given region in coefficient space.
This method should also probably work to find a random polynomial whose roots are inside any connected open set, and subject to certain geometric limitations (for instance, it can't be inside the unit circle) a nearly uniformly random algebraic integer of high degree whose Galois conjugates are inside a given connected open set.
Of course still more interesting than an empirical simulation would be a good theoretical analysis.
Best Answer
The usual approach is to generate $n+1$ i.i.d. mean zero Gaussian random variables $X_1, \dotsc, X_{n+1}$ to get a random point $X$ in $(n+1)$-space with rotationally invariant distribution and normalize.
Incidentally, if you ever actually need to generate a random point in an $n$-ball, the best way is probably to generate a random point in the $(n+1)$-sphere as above and drop the last two coordinates.