randseed

Generate prime numbers for use as random number seeds

Syntax

out = randseed
out = randseed(state)
out = randseed(state,m)
out = randseed(state,m,n)
out = randseed(state,m,n,rmin)
out = randseed(state,m,n,rmin,rmax)

Description

The randseed function is designed for producing random prime numbers that work well as seeds for random source blocks or noisy channel blocks in Communications Blockset™ software.

out = randseed generates a random prime number between 31 and 217-1, using the MATLAB® function rand.

out = randseed(state) generates a random prime number after setting the state of rand to the positive integer state. This syntax produces the same output for a particular value of state.

out = randseed(state,m) generates a column vector of m random primes.

out = randseed(state,m,n) generates an m-by-n matrix of random primes.

out = randseed(state,m,n,rmin) generates an m-by-n matrix of random primes between rmin and 217-1.

out = randseed(state,m,n,rmin,rmax) generates an m-by-n matrix of random primes between rmin and rmax.

Examples

To generate a two-element sample-based row vector of random bits using the Bernoulli Random Binary Generator block, you can set Probability of a zero to [0.1 0.5] and set Initial seed to randseed(391,1,2).

To generate three streams of random data from three different blocks in a single model, you can define out = randseed(93,3) in the MATLAB workspace and then set the three blocks' Initial seed parameters to out(1), out(2), and out(3), respectively.

See Also

rand, primes

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS