主要内容

qrand

类:qrandstream

从流生成拟随机点

语法

x = qrand (q)
X = qrand (q, n)

描述

x = qrand (q)返回下一个值x在拟随机流qrandstream类。x是1 -d向量,d流的维数。命令集q.State指数在底层点集的下一个值返回。

X = qrand (q, n)返回下一个nX在一个n——- - - - - -d矩阵。

对象qrandstream类封装属性指定拟随机的数字流。的流值并不生成并存储在内存中,直到访问使用qrand

例子

使用qrandstream构建一个三维荷流,基于点集,跳过第一个1000值然后保留每101点:

q = qrandstream(“荷”3“跳过”,1 e3,“飞跃”,1 e2)拟随机q =哈尔顿流三维点集属性:跳过:1000飞跃:100 ScrambleMethod:没有nextIdx =问。州nextIdx = 1

使用qrand生成两个样本的大小四:

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 =问。州nextIdx = 5 X2 = qrand (q, 4) X2 = 0.2446 0.0238 0.8102 0.5298 0.7540 0.0438 0.3843 0.5112 0.2758 0.8335 0.2245 0.4694 nextIdx =问。州nextIdx = 9

使用重置重置流,然后生成另一个示例:

重置(q) nextIdx =问。州nextIdx = 1X= 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

另请参阅

|