## Documentation Center |

Generate uniformly distributed, quantized random number
using `quantizer` object

`randquant(q,n)randquant(q,m,n)randquant(q,m,n,p,...)randquant(q,[m,n])randquant(q,[m,n,p,...])`

`randquant(q,n)` uses `quantizer` object `q` to
generate an `n`-by-`n` matrix with
random entries whose values cover the range of `q` when `q` is
a fixed-point `quantizer` object. When `q` is
a floating-point `quantizer` object, `randquant` populates
the `n`-by-`n` array with values
covering the range

-[square root of realmax(q)] to [square root of realmax(q)]

`randquant(q,m,n)` uses `quantizer` object `q` to
generate an `m`-by-`n` matrix with
random entries whose values cover the range of `q` when `q` is
a fixed-point `quantizer` object. When `q` is
a floating-point `quantizer` object, `randquant` populates
the `m`-by-`n` array with values
covering the range

-[square root of realmax(q)] to [square root of realmax(q)]

`randquant(q,m,n,p,...)` uses `quantizer` object
q to generate an `m`-by-`n`-by-`p`-by
... matrix with random entries whose values cover the range of `q` when `q` is
fixed-point `quantizer` object. When `q` is
a floating-point `quantizer` object, `randquant` populates
the matrix with values covering the range

-[square root of realmax(q)] to [square root of realmax(q)]

`randquant(q,[m,n])` uses `quantizer` object `q` to
generate an `m`-by-`n` matrix with
random entries whose values cover the range of `q` when `q` is
a fixed-point `quantizer` object. When `q` is
a floating-point `quantizer` object, `randquant` populates
the `m`-by-`n` array with values
covering the range

-[square root of realmax(q)] to [square root of realmax(q)]

`randquant(q,[m,n,p,...])` uses `quantizer` object `q` to
generate `p` `m`-by-`n` matrices
containing random entries whose values cover the range of `q` when `q` is
a fixed-point `quantizer` object. When `q` is
a floating-point `quantizer` object, `randquant` populates
the `m`-by-`n` arrays with values
covering the range

-[square root of realmax(q)] to [square root of realmax(q)]

`randquant` produces pseudorandom numbers.
The number sequence `randquant` generates during
each call is determined by the state of the generator. Because MATLAB^{®} resets
the random number generator state at startup, the sequence of random
numbers generated by the function remains the same unless you change
the state.

`randquant` works like `rng` in
most respects.

```
q=quantizer([4 3]);
rng('default')
randquant(q,3)
ans =
0.5000 0.6250 -0.5000
0.6250 0.1250 0
-0.8750 -0.8750 0.7500
```

Was this topic helpful?