| MATLAB® | ![]() |
s = RandStream('gentype')
[...]=RandStream('gentype','param1',val1,'param2',val2,...)
s = RandStream('gentype') creates a random number stream that uses the uniform pseudorandom number generator algorithm specified by gentype.[...]=RandStream('gentype','param1',val1,'param2',val2,...) allows you to specify optional parameter name/value pairs to control creation of the stream. Options for gentype are given by RandStream.list.
Parameters are for RandStream are:
| Parameter | Description |
|---|---|
| Seed | Nonnegative scalar integer with which to initialize all streams.
Default is 0. Seeds must be an integer between 0 and
. |
| RandnAlg | Algorithm used by randn(s, ...) to generate normal pseudorandom values. Possible values are 'Ziggurat', 'Polar', or 'Inversion'. |
Construct a random stream object using the combined multiple recursive generator and generate 5 uniformly distributed values from that stream.
stream=RandStream('mrg32k3a');
rand(stream,1,5)Construct a random stream object using the multiplicative lagged Fibonacci generator and generate 5 normally distributed values using the polar algorithm.
stream=RandStream('mlfg6331_64','RandnAlg','Polar');
randn(stream,1,5)@RandStream, rand (RandStream), randn (RandStream), randi (RandStream), getDefaultStream (RandStream)
![]() | RandStream | rank | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |