time | Calls | line |
---|
| | 401 | function old = setGlobalStream(stream)
|
| | 402 | %RANDSTREAM.SETGLOBALSTREAM Replace the global random number stream.
|
| | 403 | % PREVSTREAM = RandStream.SETGLOBALSTREAM(STREAM) sets STREAM as the current
|
| | 404 | % global random number stream, i.e., designates it as the stream that the
|
| | 405 | % RAND, RANDI, and RANDN functions will draw values from. PREVSTREAM is the
|
| | 406 | % stream that was previously designated as the global random number stream.
|
| | 407 | %
|
| | 408 | % RAND, RANDI, and RANDN all rely on the same stream of uniform pseudorandom
|
| | 409 | % numbers, known as the global random number stream. RAND draws one value
|
| | 410 | % from that stream to generate each uniform value it returns; RANDI draws
|
| | 411 | % one uniform value from that stream to generate each integer value it
|
| | 412 | % return; and RANDN draws one or more uniform values to generate each normal
|
| | 413 | % value it returns. Note that there are also RAND, RANDI, and RANDN methods
|
| | 414 | % for which you specify a specific random stream from which to draw values.
|
| | 415 | %
|
| | 416 | % The RNG function is a shorter alternative for many uses of
|
| | 417 | % RANDSTREAM.setGlobalStream.
|
| | 418 | %
|
| | 419 | % See also RNG, RANDSTREAM, RANDSTREAM.GETGLOBALSTREAM,
|
| | 420 | % RANDFUN/RAND, RANDFUN/RANDN, RANDFUN/RANDI.
|
< 0.001 | 1 | 421 | if nargout > 0
|
| | 422 | old = localGetSetGlobalStream();
|
< 0.001 | 1 | 423 | end
|
0.001 | 1 | 424 | localGetSetGlobalStream(stream);
|
< 0.001 | 1 | 425 | end
|
Other subfunctions in this file are not included in this listing.