Hi,
I want to have a 100-by-2000 matrix of random numbers. Each column of random numbers is generated by an independent stream. It means there should be 2000 independent streams.
I learn from "Help: Create three independent streams"
[s1,s2,s3] = RandStream.create('mrg32k3a','NumStreams',3);
r1 = rand(s1,100000,1); r2 = rand(s2,100000,1); r3 = rand(s3,100000,1);
It is very easy with 3 independent streams.
How can I efficiently create this matrix of random numbers from 2000 independent streams?
Thank you!
No products are associated with this question.
3 Comments
Direct link to this comment:
http://mathworks.com/matlabcentral/answers/42490#comment_87162
Are you sure that you need 2000 independent streams? Will you be able to distinguish it from rand(100, 20000)?
Direct link to this comment:
http://mathworks.com/matlabcentral/answers/42490#comment_87185
+1 Jan
Direct link to this comment:
http://mathworks.com/matlabcentral/answers/42490#comment_87274
My first attempt to generate the 100-by-2000 matrix with random numbers is simply using "rand" or "randi."
The three main steps involving random numbers generation in the script are as followed.
When this for-loop finished, I observed clearly that the y values in the last 200 to 500 columns fluctuated around zero or still are zero but the all other y values from column 1 to column 1500 vary between -1 and 8.
I don't understand why this happen. I expected all columns should vary between -1 and 8.
The goal I want to reach is that all the random number generating(random N, random y values, rand(1,length(A)) in each column is independent to each other. The calculation of E value in each column is a independent simulation (i.e. I want to do 2000 independent simulations simultaneously).
However,the present results I have is that some columns seems untouched.
How can I modify the script to accomplish my goal?
Thanks !