The goal of this simulation is create a random walk to check the steps behavior through the time and how it respects the Central Limit Theorem, i.e., since the average and standard deviation are finite, the curve will be a normal distribution.
# The variable "sinal" is a sample with range from -1 to 1 tha will walk 1000 steps:
sinal = sample(c(-1,1), 1000, replace = T)
# These steps will be a exponential distribution as follows:
passos = sinal*rexp(1000)
#plot(pressure)
plot(passos,col= 'red', type = 'l')
hist(passos,30)
curve(dnorm(x)*510, add = T, col='red')