# How do you create a 2D random walk? [duplicate]

I've been trying to create a 2D random walk process for my project. The question is as follows, Create a 2-dimensional random walk process where the walker can move up, down, left, or right. The walker should have an equal chance of going in any direction (25%). Create a graph of a single walk.

We've been using these functions but I'm unsure how to go about it correctly.

A = Table[0, {1}, {2}];
Do[
x = RandomReal[];
Which[
x < 0.25, A[[i + 1, 1]] = A[[i, 1]] + 1;
x < 0.25, A[[i + 1, 2]] = A[[i, 2]] - 1],
{i, 1, 0}, {i, 1, 1}]
ListLinePlot[A]


It's supposed to look like this. Thanks

• Perhaps you could draw inspiration from previously asked questions on this site (use the search bar at the top of the page). For instance, this question and its answers might be a good start: 2D random walk within a bounded area. Apr 24, 2018 at 4:00
• Okay, thank you. Apr 25, 2018 at 3:23

ListLinePlot[Accumulate@RandomChoice[{{1, 0}, {-1, 0}, {0, 1}, {0, -1}}, 500]]