g05te Method
関数リスト一覧   NagLibrary Namespaceへ  ライブラリイントロダクション  本ヘルプドキュメントのchm形式版

g05te generates a vector of pseudorandom integers from the discrete hypergeometric distribution of the number of specified items in a sample of size l, taken from a population of size n with m specified items in it.

Syntax

C#
public static void g05te(
	int mode,
	int n,
	int ns,
	int np,
	int m,
	double[] r,
	G05..::.G05State g05state,
	int[] x,
	out int ifail
)
Visual Basic (Declaration)
Public Shared Sub g05te ( _
	mode As Integer, _
	n As Integer, _
	ns As Integer, _
	np As Integer, _
	m As Integer, _
	r As Double(), _
	g05state As G05..::.G05State, _
	x As Integer(), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g05te(
	int mode, 
	int n, 
	int ns, 
	int np, 
	int m, 
	array<double>^ r, 
	G05..::.G05State^ g05state, 
	array<int>^ x, 
	[OutAttribute] int% ifail
)
F#
static member g05te : 
        mode:int * 
        n:int * 
        ns:int * 
        np:int * 
        m:int * 
        r:float[] * 
        g05state:G05..::.G05State * 
        x:int[] * 
        ifail:int byref -> unit 

Parameters

mode
Type: System..::.Int32
On entry: a code for selecting the operation to be performed by the method.
mode=0
Set up reference vector only.
mode=1
Generate variates using reference vector set up in a prior call to g05te.
mode=2
Set up reference vector and generate variates.
mode=3
Generate variates without using the reference vector.
Constraint: mode=0, 1, 2 or 3.
n
Type: System..::.Int32
On entry: n, the number of pseudorandom numbers to be generated.
Constraint: n0.
ns
Type: System..::.Int32
On entry: l, the sample size of the hypergeometric distribution.
Constraint: 0nsnp.
np
Type: System..::.Int32
On entry: n, the population size of the hypergeometric distribution.
Constraint: np0.
m
Type: System..::.Int32
On entry: m, the number of specified items of the hypergeometric distribution.
Constraint: 0mnp.
r
Type: array< System..::.Double >[]()[]
An array of size [lr]
Note: lr must satisfy the constraint:
  • if mode=0 or 2, lr must not be too small, but the limit is too complicated to specify;
  • if mode=1, lr must remain unchanged from the previous call to g05te.
On entry: if mode=1, the reference vector from the previous call to g05te.
If mode=3, r is not referenced by g05te.
On exit: the reference vector.
g05state
Type: NagLibrary..::.G05..::.G05State
An object of type G05.G05State.
x
Type: array< System..::.Int32 >[]()[]
An array of size [n]
On exit: the pseudorandom numbers from the specified hypergeometric distribution.
ifail
Type: System..::.Int32 %
On exit: ifail=0 unless the method detects an error (see [Error Indicators and Warnings]).

Description

g05te generates n integers xi from a discrete hypergeometric distribution, where the probability of xi=I is
Pi=I= l!m!n-l!n-m! I!l-I!m-I!n-m-l+I!n!   if  I = max0,m+l-n , , minl,m , Pi=I=0   otherwise.
The variates can be generated with or without using a search table and index. If a search table is used then it is stored with the index in a reference vector and subsequent calls to g05te with the same parameter values can then use this reference vector to generate further variates. The reference array is generated by a recurrence relation if lmn-ln-m<50n3, otherwise Stirling's approximation is used.

References

Error Indicators and Warnings

Accuracy

Further Comments

Example

See Also