In this example, we will learn how to generate a random value based on an array of values in Python NumPy.

### Source Code

```
from numpy import random
n = random.choice([1, 2, 3, 4, 5, 6])
print(n)
```

Output:

```
3
```

In this example, we will learn how to generate a random value based on an array of values in Python NumPy.

```
from numpy import random
n = random.choice([1, 2, 3, 4, 5, 6])
print(n)
```

Output:

```
3
```

Subscribe

0 Comments