First working JS random walk