V130: Random Three-Dimensional Vectors

Author(s): F. James Library: MATHLIB
Submitter: Submitted: 15.09.1978
Language: Fortran Revised:

tex2html_wrap64

RAN3D generates random vectors, uniformly distributed over the surface of a sphere of a given radius.

Structure:

SUBROUTINE subprogram
User Entry Names: RAN3D
External References: NRAN

Usage:

    CALL RAN3D(X,Y,Z,XLONG)
X,Y,Z
(REAL) A random 3-dimensional vector of length XLONG.
XLONG
(REAL) Length of the vector (to be specified on entry).

Method:

A random vector in the unit cube is generated using NRAN (V105) and is rejected if it lies outside the unit sphere. This rejection technique uses on average about 6 random numbers per vector, where only two are needed in principle. However, it is faster than the classical two-number technique which requires a square root, a sine, and a cosine.
tex2html_wrap_inline62


Michel Goossens Wed Jun 5 08:43:57 METDST 1996