Click4Ai

440.

Hard

In this problem, you will be implementing a function to sample actions from a continuous action space. The action space is a 2D space where the x-coordinate is the action in the first dimension and the y-coordinate is the action in the second dimension. The goal is to sample a random action within a specified range. **Example:** If the action space is [-1, 1] and the range is [-0.5, 0.5], a valid action could be [0.2, -0.3]. **Constraints:** The action space should be a 2D space with the specified range. The sampled action should be within the specified range.

Test Cases

Test Case 1
Input: [[-1, 1], [-0.5, 0.5]]
Expected: [0.2, -0.3]
Test Case 2
Input: [[-2, 2], [-1, 1]]
Expected: [0.8, -0.4]
+ 3 hidden test cases