I have ranges, where each tuple represents the range of a random number. e.g:
ranges = [(-1,100), (0,1), (50, 5000)]
Now, I want to create a numpy array where each element of array is randomly generated from the corresponding tuple of ranges.
Pseudo code:
rand_array = numpy.array[randomly generate element1 from (-1,100), randomly generate element2 from (0,1), randomly generate element3 from (50,500)]
Of course, naive way to do this is:
rand_array = [random.uniform(coord[0], coord[1]) for coord in ranges]
But I want to do it in numpy way, as my whole code accepts numpy array data-types. Another solution can be to convert naively generated rand_array to numpy array. But I think it is not efficient. Is there a numpy way of doing this?