# Simulating Brownian motion with jumps

I am trying to improve my understanding of jump processes.

As a first step, I want to simulate sample paths for the process $$dX(t) = dw(t) + dJ(t)$$ where $dw(t)$ is a Brownian motion and $dJ(t)$ is a compound Poisson process with intensity $\lambda = 5$ and $\mathcal{D} = \mathcal{N}(0,1)$. Can anyone verify that the reasoning of my Mathematica code is sound?

T = 10;
n = 1000;
dt = T/n;
lambda = 5;
dw = RandomVariate[NormalDistribution[0, Sqrt[dt]], n];
dJ = Table[
If[RandomVariate[BernoulliDistribution[lambda dt]] == 0, 0,
RandomVariate[NormalDistribution[]]], {i, 1, n}];
dX = dw + dJ;
BrownianJumpPath = Accumulate[Prepend[dX, 0]];
ListLinePlot[BrownianJumpPath, Frame -> True]


• simulate $N$ with intensity $\lambda T$ ... the number of jumps during the interval from $[0,T]$.
• Simulate $N$ uniformly distributed uniforms (independent of $N$) uniformly distributed on $[0,T]$- the jump times.