A random walk1 is a random process in which a state at time t is only dependent on the state at time t-1. Let us take a look at the following process:

Xt=Xt1+N(0,σ2)

with N(0,σ2) being a normal distribution with mean 0 and variance σ2.

Simulate a random walk of 100 steps using the standard normal distribution (i.e. with σ2=1):

In order to validate your (random) results, we set a seed for R’s random number generator, which you can leave as is.