g05ym 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 methods g05yl or g05yn.


public static void g05ym(
	int n,
	int rcord,
	double[,] quas,
	int[] iref,
	out int ifail
Visual Basic
Public Shared Sub g05ym ( _
	n As Integer, _
	rcord As Integer, _
	quas As Double(,), _
	iref As Integer(), _
	<OutAttribute> ByRef ifail As Integer _
Visual C++
static void g05ym(
	int n, 
	int rcord, 
	array<double,2>^ quas, 
	array<int>^ iref, 
	[OutAttribute] int% ifail
static member g05ym : 
        n : int * 
        rcord : int * 
        quas : float[,] * 
        iref : int[] * 
        ifail : int byref -> unit 


Type: System..::..Int32
On entry: the number of quasi-random numbers required.
Constraint: n0 and n+previous number of generated values231-1.
Type: System..::..Int32
On entry: the order in which the generated values are returned.
Constraint: rcord=1 or 2.
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, tdquas]
Note: dim1 must satisfy the constraint:
  • if rcord=1, dim1idim;
  • if rcord=2, dim1n.
On exit: contains the n quasi-random numbers of dimension idim.
If rcord=1, quas[i-1,j-1] holds the jth value for the ith dimension.
If rcord=2, quas[i-1,j-1] holds the ith value for the jth dimension.
Type: array<System..::..Int32>[]()[][]
An array of size [liref]
On entry: contains information on the current state of the sequence.
On exit: contains updated information on the state of the sequence.
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).


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.
g05ym generates a set of points x1,x2,,xN with high uniformity in the S-dimensional unit cube IS=0,1S.
Let G be a subset of IS and define the counting function SNG as the number of points xiG. For each x=x1,x2,,xSIS, let Gx be the rectangular S-dimensional region
with volume x1,x2,,xS. Then one measure of the uniformity of the points x1,x2,,xN is the discrepancy:
which has the form
DN*x1,x2,,xNCSlogNS+OlogNS-1  for all  N2.
The principal aim in the construction of low-discrepancy sequences is to find sequences of points in IS with a bound of this form where the constant CS is as small as possible.
The type of low-discrepancy sequence generated by g05ym depends on the initialization method called and can include those proposed by Sobol, Faure or Niederreiter. If the initialization method g05yn was used then the sequence will be scrambled (see [Description] in g05yn 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

Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDQUAS) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry, either n<0 or there have been too many calls to the generator.
On entry, rcord1 or 2.
On entry, rcord=1 and ldquas<idim.
On entry, rcord=2 and ldquas<n.
Incorrect initialization. g05yl must be called prior to g05ym and iref must remain unaltered after this call.
An error occured, see message report.
Invalid dimension for array value
Negative dimension for array value
Invalid Parameters value


Not applicable.

Parallelism and Performance


Further Comments



See Also