Main Content

Generate random matrix using prescribed alphabet

generates a random scalar that is either `out`

= randsrc`-1`

or
`1`

, with equal probability.

generates an `out`

= randsrc(`m`

,`n`

,[`alphabet`

; `prob`

])`m`

-by-`n`

matrix, with each entry
independently chosen from the entries in the row vector `alphabet`

.
Duplicate values in `alphabet`

are ignored. The row vector
`prob`

lists corresponding probabilities, so that the symbol
`alphabet(k)`

occurs with probability
`prob(k)`

, where `k`

is any integer between
one and the number of columns of `alphabet`

. The elements of
`prob`

must add up to 1.

accepts input combinations from prior syntaxes and a random stream handle to
generate uniform random noise samples by using `out`

= randsrc(`m`

,`n`

,___,`streamhandle`

)`rand`

. Providing a random stream
handle or using the `reset (RandStream)`

function on the
default random stream object enables you to generate repeatable noise samples. If
you want to generate repeatable noise samples, then either reset the random stream
input before calling `randsrc`

or use the same seed input. For
more information, see `RandStream`

.