# Create a random vectorΒΆ

The RandomVector object represents the concept of random variable.

In this example we are going to exhibit some of its main methods.

```import openturns as ot

ot.Log.Show(ot.Log.NONE)
```

Create a random vector

```dist3d = ot.Normal(3)
X = ot.RandomVector(dist3d)
```

Get the dimension

```X.getDimension()
```
```3
```

Get the mean

```X.getMean()
```
class=Point name=Unnamed dimension=3 values=[0,0,0]

Get the covariance

```X.getCovariance()
```

[[ 1 0 0 ]
[ 0 1 0 ]
[ 0 0 1 ]]

Draw a sample

```X.getSample(5)
```
X0 X1 X2 -0.3669958 1.4285 -1.908112 2.113194 -0.6656038 -0.1165616 1.078081 -0.5657817 -0.6800565 -0.1835751 0.768168 -2.496996 0.1510135 0.9669702 0.4488739

Extract a single component

```X1 = X.getMarginal(1)
X1.getSample(5)
```
X1 -0.05830888 1.596199 -0.9100232 0.2912405 0.3625414

Extract several components

```X02 = X.getMarginal([0, 2])
X02.getSample(5)
```
X0 X2 -0.7755861 -0.8029558 -1.348806 0.01705316 -1.728507 -0.2114691 0.6865244 0.2568323 0.5090324 0.4770067