naginterfaces.library.rand.quasi_uniform(n, comm, rcord=1)[source]

quasi_uniform generates a uniformly distributed low-discrepancy sequence as proposed by Sobol, Faure or Niederreiter. It must be preceded by a call to one of the initialization functions quasi_init() or quasi_init_scrambled().

For full information please refer to the NAG Library document for g05ym


The number of quasi-random numbers required.

commdict, communication object, modified in place

Communication structure.

This argument must have been initialized by a prior call to quasi_init() or quasi_init_scrambled().

rcordint, optional

The order in which the generated values are returned.

quasfloat, ndarray, shape

Contains the quasi-random numbers of dimension idim.

If , holds the th value for the th dimension.

If , holds the th value for the th dimension.

(errno )

On entry, .

Constraint: .

(errno )

On entry, value of would result in too many calls to the generator: , generator has previously been called times.

(errno )

On entry, .

Constraint: or .

(errno )

On entry, and .

Constraint: if , .

(errno )

On entry, [‘iref’] has either not been initialized or has been corrupted.

(errno )

On entry, the specified dimensions are out of sync.

A different number of values have been generated from at least one of the specified dimensions.


Low discrepancy (quasi-random) sequences are used in numerical integration, simulation and optimization. Like pseudorandom numbers they are uniformly distributed but they are not statistically independent, rather they are designed to give more even distribution in multidimensional space (uniformity). Therefore, they are often more efficient than pseudorandom numbers in multidimensional Monte Carlo methods.

quasi_uniform generates a set of points with high uniformity in the -dimensional unit cube .

Let be a subset of and define the counting function as the number of points . For each , let be the rectangular -dimensional region

with volume . Then one measure of the uniformity of the points is the discrepancy:

which has the form

The principal aim in the construction of low-discrepancy sequences is to find sequences of points in with a bound of this form where the constant is as small as possible.

The type of low-discrepancy sequence generated by quasi_uniform depends on the initialization function called and can include those proposed by Sobol, Faure or Niederreiter. If the initialization function quasi_init_scrambled() was used then the sequence will be scrambled (see Notes for quasi_init_scrambled for details).


Bratley, P and Fox, B L, 1988, Algorithm 659: implementing Sobol’s quasirandom sequence generator, ACM Trans. Math. Software (14(1)), 88–100

Fox, B L, 1986, Algorithm 647: implementation and relative efficiency of quasirandom sequence generators, ACM Trans. Math. Software (12(4)), 362–376