I am trying to replicate this excellent answer which explains how to draw Brownian motions in TiKZ:
\newcommand{\Lathrop}[6]{% points, advance, rand factor, options, end label, truncate from point
\draw[#4] (0,0)
\foreach \x in {1,...,#6} {
-- ++ (#2,rand*#3)
}
coordinate (tempcoord) {};
\pgfmathsetmacro{\remainingwidth}{(#1-#6)*#2}; % changed to a custom number
\def\remainingwidthcustom{1};
\draw[#4] (tempcoord) -- ++ (\remainingwidthcustom,0) node[right] {#5};
}
\begin{tikzpicture}
\def\ylength{3}
\pgfmathsetseed{3} % control pseudo-random number
% Axis
\coordinate (y) at (0,3); \coordinate (x) at (6,0);
\draw[<->] (y) node[above] {$S$} -- (0,0) -- (x) node[right] {$\mathbb{N}$};
% Brownian motion
\Lathrop{750}{0.02}{0.21}{blue!70!black}{strike price $S_N$}{250};
\end{tikzpicture}
My problem is that I cannot change it to the geometric Brownian motion for two reasons:
- I cannot get exponential function via
pgfmathparse - I do not fully understand the syntax inside the
\foreach \x-loop.
Any help is appreciated.

-ln(1-x)where x is a uniform random varaible over [0,1). – John Kormylo Jan 04 '23 at 16:02