qrand

类:qrandstream

生成流准随机点

句法

X = qrand(q)的
X = qrand(Q,N)

描述

X = qrand(q)的返回下一个值X在准随机数流qqrandstream类。X是1逐d向量,其中d是流的尺寸。该命令集q.State到基础点集的下一个值的索引被返回。

X = qrand(Q,N)返回下一个ñXñ-通过-d矩阵。

对象qqrandstream指定的准随机数流的类封装特性。流的值不被生成并存储在存储器中,直到q使用访问qrand

例子

qrandstream构造3-d哈尔顿流的基础上,一个点集合跳过前1000个值,然后保持每第101点:

Q = qrandstream( '哈尔顿',3, '跳过',1E3, '飞跃',1E2)3名维Q =哈尔顿准随机流点集属性:跳过:1000飞跃:100 ScrambleMethod:无nextIdx = q.StatenextIdx = 1

qrand以产生大小的4的两个样品:

X1 = qrand(Q,4)X1 = 0.0928 0.3475 0.0051 0.6958 0.2035 0.2371 0.3013 0.8496 0.4307 0.9087 0.5629 0.6166 nextIdx = q.State nextIdx = 5 X2 = qrand(Q,4)X 2 = 0.2446 0.0238 0.8102 0.5298 0.7540 0.0438 0.3843 0.5112 0.2758 0.83350.2245 0.4694 nextIdx = q.State nextIdx = 9

重启重置流,然后产生另一个样品:

复位(Q)nextIdx = q.State nextIdx = 1 X = qrand(Q,4)X = 0.0928 0.3475 0.0051 0.6958 0.2035 0.2371 0.3013 0.8496 0.4307 0.9087 0.5629 0.6166

也可以看看

|