I am trying to write a code for random walk, and in the direction part, I met this problem. I want the direction to be any degrees, what I do is try to use py.arrange to generate as many numbers as possible between -1 and 1. I want to ask is there any better solutions to go through all the numbers between -1 and 1? Thanks!
Here is my code:
def fill_walk(self):
while len(self.x_values)<self.num_points:
x_direction=choice(np.arange(-1,1,0.00001))
x_distance=(int(1))
x_step=x_direction*x_distance
y_direction=choice(np.arange(-1,1,0.00001))
y_distance=(int(1))
y_step=y_direction*y_distance