# Simulations Functions

In this section we document data structures and methods for Monte Carlo simulation and path setup.

## Monte Carlo Simulation

`DiffFusion.Simulation`

— Type```
struct Simulation
model::Model
times::AbstractVector
X::AbstractArray
end
```

A `Simulation`

object represents the result of a Monte Carlo simulation.

Elements are:

`model`

- the model used for simulation.`times`

- vector of simulation times starting with 0.`X`

- tensor of size (`N_1`

,`N_2`

,`N_3`

) and type`ModelValue`

where`N_1`

is`length(m.state_alias)`

,`N_2`

is number of Monte Carlo paths,`N_3`

is`length(times)`

.

`DiffFusion.pseudo_brownian_increments`

— Function```
pseudo_brownian_increments(
n_states::Int,
n_paths::Int,
n_times::Int, # without zero
seed::Int = 271828182846,
)
```

A simple method to generate Brownian motion increments.

`DiffFusion.sobol_brownian_increments`

— Function```
sobol_brownian_increments(
n_states::Int,
n_paths::Int,
n_times::Int, # without zero
)
```

Generate Brownian motion increments via Sobol sequence.

`DiffFusion.simple_simulation`

— Function```
simple_simulation(
model::Model,
ch::CorrelationHolder,
times::AbstractVector,
n_paths::Int;
with_progress_bar::Bool = true,
brownian_increments::Function = pseudo_brownian_increments
)
```

A simple Monte Carlo simulation method assuming all model components are state-independent.