0

How can I build an algorithm which creates a random walk but subject to the constraint that I give the initial and final positions.

  • How can I do it? Let's say I meet a drunk guy on the street. I know from where the guy came and also where we are.

  • How would I create a possible random path in this setting? (let's simplify to $1$D problem).

Rodolfo
  • 47
  • Your algorithm should 1: set the start position at the required point 2: take a random step 3: check if we're at the end point. If not, return to point 2 – David Nov 15 '21 at 15:18
  • @David Wow. That is not doable. With a walk of 100 steps, I have to get to initial position everytime (basically). And if I consider float numbers, it's not doable at all. – Rodolfo Nov 15 '21 at 15:25
  • One possibility: precompute and tabulate many random walks. Then in real time choose one at random. (The statistics will probably not match those of a real random walk so constrained, but may be good enough for your application.) – Ethan Bolker Nov 15 '21 at 15:39
  • If the length of the walk is given, instantiating a realization of the walk should be straightforward. Which distribution to draw the length from? Some googling yields this. In the abstract they claim to calculate the exit time distribution – Sal Nov 15 '21 at 16:35
  • @Rodolfo That depends on the dimension you're making your walk and if you fix the number of steps. Please try defining your problem a bit more clearly – David Nov 15 '21 at 18:25
  • I can fix the numbers of steps, yes. But I wanted it to work with a normal distribution in terms of the variations. The best way I found so far was to initialize a flat array and then, pick an index and apply a random variation with center being the average value of the two adjacent elements, many times. But it takes to much time.. – Rodolfo Nov 16 '21 at 19:42

0 Answers0