The OpenD Programming Language

SphereVariable

Uniform distribution on a sphere.

Members

Aliases

Element
alias Element = T
opCall
void opCall(G* gen, T[] result)

Functions

opCall
void opCall(G gen, T[] result)

Manifest constants

isNdRandomVariable
enum isNdRandomVariable;

Return Value

X ~ 1 with X[0]^^2 + .. + X[$-1]^^2 = 1

Examples

Generate random points on a circle

import mir.random.engine;
import mir.math.common: fabs;

double[2] x;
sphereVar()(rne, x);
assert(fabs(x[0] * x[0] + x[1] * x[1] - 1) < 1e-10);

Meta