RandomFunction[proc,{tmin,tmax}]
generates a pseudorandom function from the process proc from tmin to tmax.
RandomFunction[proc,{tmin,tmax,dt}]
generates a pseudorandom function from tmin to tmax in steps of dt.
RandomFunction[proc,…, n]
generates an ensemble of n pseudorandom functions.
RandomFunction
RandomFunction[proc,{tmin,tmax}]
generates a pseudorandom function from the process proc from tmin to tmax.
RandomFunction[proc,{tmin,tmax,dt}]
generates a pseudorandom function from tmin to tmax in steps of dt.
RandomFunction[proc,…, n]
generates an ensemble of n pseudorandom functions.
Details and Options
- RandomFunction returns a TemporalData object that can be used to extract several properties including the paths consisting of time-value pairs {{t1,x[t1]},…}.
- For discrete-time processes such as BinomialProcess or ARMAProcess, the step dt is taken to be 1.
- For continuous-time processes with jumps, such as PoissonProcess and QueueingProcess, the step dt is random and given by the process itself.
- For continuous-time processes without jumps, such as WienerProcess and ItoProcess, an explicit dt needs to be given.
- RandomFunction gives a different random function whenever you run the Wolfram Language. You can start with a particular seed, using SeedRandom.
- The following options can be given:
-
Method Automatic what method to use WorkingPrecision Automatic precision used in internal computations - With the setting WorkingPrecision->p, random numbers of precision p will be generated.
- Special settings for Method are documented under the individual random process reference pages.
Examples
open all close allBasic Examples (5)
Simulate a discrete-time and discrete-state process:
RandomFunction[BinomialProcess[1 / 3], {0, 50}]ListPlot[%, Filling -> Axis]Simulate a continuous-time and discrete-state process:
RandomFunction[PoissonProcess[1], {0, 10}]ListStepPlot[%, Filling -> Axis]Simulate a discrete-time and continuous-state process:
RandomFunction[ARProcess[{0.7}, 1], {0, 50}]ListPlot[%, Filling -> Axis, AxesOrigin -> {0, 0}]Simulate a continuous-time and continuous-state process:
RandomFunction[WienerProcess[], {0, 10, 0.1}]ListLinePlot[%, Filling -> Axis, AxesOrigin -> {0, 0}]Simulate an ensemble of 10 paths:
RandomFunction[WienerProcess[], {0, 10, 0.1}, 10]ListLinePlot[%]Scope (21)
Basic Uses (6)
RandomFunction returns a TemporalData object:
sample = RandomFunction[PoissonProcess[3.4], {0, 7}]sample["Path"]Simulate a vector-valued process:
proc = ARProcess[{1, 2}, {{{.3, .2}, {.1, -.3}}}, {{.3, 0}, {0, .2}}];
path = RandomFunction[proc, {40}]Normal[path][[1, ;; 10]]Visualize the path on the plane:
ParametricPlot[TimeSeries[path][t], {t, 0, 40}, AxesOrigin -> {0, 0}, ColorFunction -> Function[{x, y, t}, (ColorData["AvocadoColors"][t])]]Estimate the parameters for a random process using a sample path:
data = RandomFunction[RandomWalkProcess[.3], {0, 10 ^ 3}];FindProcessParameters[data, RandomWalkProcess[p]]Use a simulation to find the expected path:
data = RandomFunction[OrnsteinUhlenbeckProcess[0, .3, .3, 2], {0, 10, .5}, 10 ^ 2];sim = ListLinePlot[data, Joined -> True]Calculate the mean for each time stamp:
mean = TimeSeriesThread[Mean, data];Show[sim, ListLinePlot[mean, Joined -> True, PlotStyle -> Directive[Thick, Yellow]]]Use a simulation to find confidence bands for a random path:
data = RandomFunction[RenewalProcess[GammaDistribution[2, 3]], {0, 50}, 10 ^ 2];sim = ListLinePlot[data, Joined -> True]Calculate the standard error bands for each time stamp:
sd1 = TimeSeriesThread[Mean[#] - StandardDeviation[#]&, data];
sd2 = TimeSeriesThread[Mean[#] + StandardDeviation[#]&, data];Show[sim, ListLinePlot[{sd1, sd2}, Joined -> True, PlotStyle -> Directive[Dashed, Yellow]]]Simulate an ensemble of 1000 paths:
data = RandomFunction[WienerProcess[1, 1 / 2], {0, 10, 0.1}, 10 ^ 3];Compute data slices from paths and plot their distribution shapes:
DistributionChart[Table[data["SliceData", t], {t, 1, 10}]]Compute slice distributions at the same time stamps and plot their distribution shapes:
DistributionChart[Table[RandomVariate[WienerProcess[1, 1 / 2][t], 10 ^ 3], {t, 1, 10}]]Parametric Processes (3)
data = RandomFunction[BernoulliProcess[3 / 4], {0, 30}]ListPlot[data, Filling -> Axis]data = RandomFunction[WienerProcess[.2, .7], {0, 1, 0.01}]ListLinePlot[%, Filling -> Axis]Simulate a compound Poisson process with an exponential jump size distribution:
𝒫 = CompoundPoissonProcess[.7, ExponentialDistribution[2.1]];data = RandomFunction[𝒫, {0, 20}];ListStepPlot[data, Filling -> Axis]Queueing Processes (2)
Simulate an M/M/1 queue with different arrival and service rates:
RandomFunction[QueueingProcess[3, 5], {0, 15}]ListStepPlot[%, Filling -> Axis]Simulate a closed queueing network:
𝒬 = QueueingNetworkProcess[(| |
| - |
| 0 |
| 0 |
| 0 |), (| | | |
| - | --- | --- |
| 0 | 0.3 | 0.7 |
| 1 | 0 | 0 |
| 1 | 0 | 0 |), (| |
| ---- |
| 1 |
| 0.5 |
| 1.25 |), (| |
| - |
| 1 |
| 1 |
| 1 |), 10];RandomFunction[𝒬, {0, 50}]ListStepPlot[%, Filling -> Axis]Finite Markov Processes (1)
Simulate a discrete-time finite Markov process:
𝒫 = DiscreteMarkovProcess[{1, 0, 0}, (| | | |
| ----- | ----- | ----- |
| 0 | 1 / 2 | 1 / 2 |
| 1 / 2 | 0 | 1 / 2 |
| 1 / 2 | 1 / 2 | 0 |)];data = RandomFunction[𝒫, {0, 30}]ListPlot[data, Filling -> Axis, Ticks -> {Automatic, {1, 2, 3}}]Simulate a discrete-time hidden Markov process:
proc = HiddenMarkovProcess[{0.3, 0.7}, {{0.95, 0.05}, {0.1, 0.9}}, {NormalDistribution[-1.1, 0.3], NormalDistribution[2.4, 0.5]}];data = RandomFunction[proc, {0, 100}, 100]Histogram[data, Automatic, "PDF"]Time Series Processes (5)
Simulate a moving-average process:
RandomFunction[MAProcess[{.3}, .1], {1, 10}]["Path"]Simulate an autoregressive process:
sample = RandomFunction[ARProcess[{-.2, .3}, .1], {1, 100}];ListPlot[sample, Filling -> Axis]Simulate an autoregressive moving-average process with given precision:
RandomFunction[ARMAProcess[{1 / 10}, {-3 / 10}, 2 / 10], {1, 6}, WorkingPrecision -> 9]["Path"]Simulate a few integrated autoregressive moving-average processes:
sample = RandomFunction[ARIMAProcess[{.2, .3}, 1, {.2, -.1}, .1], {1, 100}, 3];ListPlot[sample, Filling -> Axis]Simulate a vector-valued SARIMA time series:
A = {{.4, .3}, {-.3, .4}};
B = {{.2, .5}, {-.2, .3}};
Σ = {{1, 0}, {0, .3}};
SeedRandom[4];sample = RandomFunction[SARIMAProcess[{}, 1, {B}, {12, {A}, 1, {}}, Σ], {1, 10 ^ 2}];
data = TimeSeries[sample, ResamplingMethod -> Automatic];Create a 3D sample path function with time:
f = data["PathFunction"];
g[t_ ? NumericQ] := Join[{t}, f[t]]The color function depends on time:
ParametricPlot3D[g[t], {t, 1, 100}, ColorFunction -> Function[{t, x, y}, (ColorData["BlueGreenYellow"][t])], PlotStyle -> Thick, BoxRatios -> 1, AspectRatio -> 1 / 2]Stochastic Differential Equation Processes (2)
𝒫 = ItoProcess[ⅆx[t] == -x[t]ⅆt + ⅆw[t], x[t], {x, 0}, {t, 0}, wWienerProcess[]];RandomFunction[𝒫, {0., 5., 0.01}]ListLinePlot[%, Filling -> Axis]Simulate a Stratonovich process:
𝒫 = StratonovichProcess[ⅆx[t] == -x[t]ⅆt + Sqrt[1 + x[t] ^ 2]ⅆw[t], x[t], {x, 1}, t, wWienerProcess[]];RandomFunction[𝒫, {0., 5., 0.01}]ListLinePlot[%, Filling -> Axis]Transformations of Random Processes (2)
𝒫 = TransformedProcess[p[t] ^ 2, pPoissonProcess[1], t];data = RandomFunction[𝒫, {0, 30, 0.1}, 3];ListStepPlot[data]Sum of a Wiener process and a geometric Brownian motion process:
𝒫 = TransformedProcess[w[t] + g[t], {wWienerProcess[], gGeometricBrownianMotionProcess[0, 1, 2]}, t];data = RandomFunction[𝒫, {0, 10, 0.1}, 3];ListLinePlot[data, PlotRange -> All]Options (1)
WorkingPrecision (1)
Generate a sample path with default machine precision:
RandomFunction[PoissonProcess[3], {6}]["Path"]Use WorkingPrecision to generate a sample path with higher precision:
RandomFunction[PoissonProcess[3], {6}, WorkingPrecision -> 20]["Path"]Applications (4)
Visualize a transformed process:
Bessel2 = TransformedProcess[Sqrt[x[t]^2 + y[t]^2], {xWienerProcess[], yWienerProcess[]}, t];data = RandomFunction[Bessel2, {0, 10, 0.01}, 3];ListLinePlot[data, PlotRange -> All]Simulate solutions of the stochastic differential equation
:
P[t_, w_] := p E^σ w + (μ - (σ^2/2)) tDefine the values of the parameters:
μ = 1.2;σ = 1 / Sqrt[50];p = 1;Simulate the Wiener process paths:
W := RandomFunction[WienerProcess[], {0, 3, 0.001}]["Path"];The solution as function of a path:
noisysol := Map[{#[[1]], P[#[[1]], #[[2]]]}&, W];ListLinePlot[Table[noisysol, {4}]]Estimate unknown slice distribution of a random process:
proc = ARCHProcess[.3, {.5}];Probability density function of slice distribution is not known in closed form:
PDF[proc[5], x]Generate a random sample of paths:
data = RandomFunction[proc, {1, 5}, 10 ^ 4];Extract values from all paths at time
:
sample = data["SliceData", 5];Visualize its probability density function:
Histogram[sample, Automatic, "PDF"]Test if it fits a standard normal distribution:
DistributionFitTest[sample, NormalDistribution[0, 1], "TestConclusion"]Approximate an ARIMAProcess with fixed initial conditions by an ARMAProcess:
proc = ARIMAProcess[{.2, -.3, -.2}, 1, {.8, -.2, .7}, 1., {}];
aproc = ARMAProcess[proc, {2, 3}]Use sample paths to assess the approximation:
SeedRandom[13];sample = RandomFunction[proc, {100}];
SeedRandom[13];asample = RandomFunction[aproc, {100}];
ListLinePlot[{sample, asample}]Properties & Relations (1)
RandomFunction generates a path for a random process:
𝒫 = WienerProcess[3.4, 4];ListLinePlot[RandomFunction[𝒫, {0, 20, 0.7}]]Use RandomVariate to generate a sample for a time slice of the process:
data = RandomVariate[𝒫[3], 10 ^ 5];Use Histogram to estimate probability density:
Histogram[data, 20, "PDF"]Possible Issues (3)
The length of a step must be smaller than the domain length:
RandomFunction[WienerProcess[], {0, 1, 2.4}]Use a step length less than 1 to get a sample path:
RandomFunction[WienerProcess[], {0, 1, 0.4}]["Path"]Continuous-time processes require a step to be specified:
RandomFunction[WienerProcess[], {0, 1}]RandomFunction[WienerProcess[], {0, 1, .1}]%["Path"]Discrete-time processes do not accept a step specification:
RandomFunction[ARProcess[{.3}, 1], {0, 3, .1}]RandomFunction[ARProcess[{.3}, 1], {0, 3}]%["Path"]Neat Examples (3)
Simulate a WienerProcess in two dimensions:
SeedRandom[103];sample = RandomFunction[WienerProcess[], {0, 1, .001}, 2]["ValueList"];ListLinePlot[Transpose@sample, ColorFunction -> "Rainbow"]Simulate a symmetric random walk in 2D:
SeedRandom[1234];data2d = RandomFunction[RandomWalkProcess[0.5], {0, 10 ^ 3}, 2];Graphics[Line[Transpose@data2d["ValueList"]], AspectRatio -> Automatic]data3d = RandomFunction[RandomWalkProcess[0.5], {0, 10 ^ 3}, 3];Graphics3D[Line[Transpose@data3d["ValueList"]], BoxRatios -> Automatic]Simulate a weakly stationary three-dimensional ARMAProcess:
A = {{.2, .1, .1}, {0, -.2, .3}, {.2, -.1, .3}};
B = {{.1, .2, -.1}, {-.1, .3, .1}, {.1, .1, 0}};
S = {{.8, .1, -.2}, {.1, .5, .1}, {-.2, .1, .3}};
proc1 = ARMAProcess[{A}, {B}, S];
data1 = RandomFunction[proc1, {100}]["Values"];Graphics3D[{Hue[RandomReal[]], Tube@Line@data1}]Non-weakly stationary process, starting at the origin:
a = {{.9, .2, .8}, {-.2, .8, -.3}, {.2, .2, .4}};
proc2 = ARMAProcess[{a}, {B}, S, {}];
data2 = RandomFunction[proc2, {100}]["Values"];Graphics3D[{Hue[RandomReal[]], Tube@Line@data2}]Related Guides
History
Text
Wolfram Research (2012), RandomFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomFunction.html.
CMS
Wolfram Language. 2012. "RandomFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomFunction.html.
APA
Wolfram Language. (2012). RandomFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomFunction.html
BibTeX
@misc{reference.wolfram_2026_randomfunction, author="Wolfram Research", title="{RandomFunction}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/RandomFunction.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_randomfunction, organization={Wolfram Research}, title={RandomFunction}, year={2012}, url={https://reference.wolfram.com/language/ref/RandomFunction.html}, note=[Accessed: 15-June-2026]}