# rbrownian: Simulation of Brownian Motions In rpgm: Fast Simulation of Normal/Exponential Random Variables and Stochastic Differential Equations / Poisson Processes

## Description

The function `rbrownian` is a C-level function which uses the Ziggurat in order to simulate the normal random variables.

## Usage

 `1` ```rbrownian(n, m, b0=0, mu=0, sd=1, T=1, drop=TRUE, nthreads=1L) ```

## Arguments

 `n` integer, number of paths. `m` integer, number of steps, the step size will be T/m. `b0` double, the initial value (or a vector of initial values of size `n`). `mu` double, the mean. `sd` double, the standard deviation. `T` double, the final date on which the brownian motion is simulated. `drop` logical, if `n = 1` and `drop = TRUE` then the function returns the single path of the brownian motion as a vector instead of a matrix. `nthreads` integer, the number of threads to use for parallelism.

## Value

Returns a n x m+1 matrix of n path of the brownian motion.

## Author(s)

Nicolas Baradel - PGM Solutions

## References

https://en.wikipedia.org/wiki/Brownian_motion

 ```1 2``` ```rbrownian(5, 10) #rbrownian(5, 10, nthreads = maxthreads()) ```