Suppose I want to create a list or a numpy array of 5 elements like this:
array = [i, j, k, l, m]
where:
i
is in range 1.5 to 12.4j
is in range 0 to 5k
is in range 4 to 16l
is in range 3 to 5m
is in range 2.4 to 8.9.This is an example to show that some ranges include fractions. What would be an easy way to do this?
You can just do (thanks user2357112!)
[np.random.uniform(1.5, 12.4), np.random.uniform(0, 5), ...]
using numpy.random.uniform
.