In this example, we will learn how to generate a random float from 0 to 1 in Python NumPy.

### Source Code

```
from numpy import random
# generate a random float from 0 to 1
n = random.rand()
print(n)
```

Output:

```
0.45116062199425666
```

In this example, we will learn how to generate a random float from 0 to 1 in Python NumPy.

```
from numpy import random
# generate a random float from 0 to 1
n = random.rand()
print(n)
```

Output:

```
0.45116062199425666
```

Subscribe

0 Comments