| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
[s1,s2,...] = RandStream.create('gentype','NumStreams',n)
s = RandStream.create('gentype')
[ ... ] = RandStream.create(..., 'PARAM1',val1, 'PARAM2',val2,
...)
[s1,s2,...] = RandStream.create('gentype','NumStreams',n) creates n random number streams that use the uniform pseudorandom number generator algorithm specified by gentype. The streams are independent in a pseudorandom sense. The streams are not necessarily independent from streams created at other times. RandStream.list returns all possible values for gentype.
Note Multiple streams are not supported by all generator types. The multiplicative lagged Fibonacci generator (mlfg6331_64) and the combined multiple recursive generator (mrg32k3a) need to be active to use multiple stream creation. |
s = RandStream.create('gentype') creates a single random stream.
[ ... ] = RandStream.create(..., 'PARAM1',val1, 'PARAM2',val2, ...) allows you to specify optional parameter name or value pairs to control creation of the stream(s). The parameters are:
| NumStreams | Total number of streams of this type that will be created across sessions or labs. Default is 1. |
| StreamIndices | Stream indices that should be created in this call. Default is 1:N, where N is the value given with the 'NumStreams' parameter. |
| Seed | Nonnegative scalar integer with which to initialize all streams.
Default is 0. Seeds must be an integer between 0 and
|
| RandnAlg | Algorithm that will be used by randn(S, ...) to generate normal pseudorandom values. Options are 'Ziggurat', 'Polar', or 'Inversion'. |
| CellOutput | Logical flag indicating whether or not to return the stream objects as elements of a cell array. Default is false. |
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);
corrcoef([r1,r2,r3])Create one stream from a set of three independent streams and designate it as the default stream.
s2 = RandStream.create('mrg32k3a','NumStreams',3,'StreamIndices',2);
RandStream.setDefaultStream(s2);
@RandStream, RandStream (RandStream), list (RandStream), getDefaultStream (RandStream), setDefaultStream (RandStream), rand (RandStream), randi (RandStream), randn (RandStream).

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2010- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |