### 20.3.5 Generating random vectors and lists

The randvector command creates random vectors (see also Section 11.1.28).

- randvector takes one mandatory argument and one optional argument:
  - n, an integer.
  - Optionally, X, which can be an integer or a random variable. In place of a random variable, the specifications for a distribution can be used. (See Section 20.3.4 for random variables and their specifications.)
- randvector(n,X) returns a vector of size n containing random integers:
  - with no second argument, distributed uniformly between −99 and +99.
  - with a second argument of X, distributed uniformly between 0 and k−1.
  - with a second argument the specification of a distribution, distributed according to this distribution.

#### Examples

randvector(3)

| ⎡ ⎣ | −64,−30,70 | ⎤ ⎦

randvector(3,5)

or:

randvector(3,'rand(5)')

| ⎡ ⎣ | 2,4,2 | ⎤ ⎦

randvector(3,'randnorm(0,1)')

| ⎡ ⎣ | −0.361127118455,−0.018325111754,1.11875485898 | ⎤ ⎦

randvector(3,2..4)

| ⎡ ⎣ | 3.18034843914,2.48592940345,2.57507958449 | ⎤ ⎦