# Tag Info

### How can I generate the same random number in Mathematica and MATLAB?

If it is solely for regression testing, the quality of the random numbers doesn't matter very much. You can substitute a better random number generator once you know the Mathematica version matches ...
• 16.8k

### Generating random sequence of integers with ordering constraints

Perhaps have a look at DiscreteMarkovProcess using an appropriate transition matrix embedding your constraints? Here's a simple example, implementing 1-5 above, to ...
• 4,385
Accepted

### Modelling snowfall as a random walk with a drift

I don't think Accumulate is powerful enough. Rather, you should use FoldList. ...
• 108k
Accepted

### Survival Probability for Random Walks

Something seems odd to me about your code. You are summing twice, once with Accumulate and once with FoldList. If this is ...
• 272k
Accepted

### How to simulate a random walk to randomly generated particle to another particle fixed at the center of a grid?

So, here is my reformulations of C.E.'s code. What has changed: I use reservoirs rand and randpts of large random arrays; ...

### Record Statistics for Discrete Random Walks

Here's one take: path = Accumulate[RandomVariate[LaplaceDistribution[0, 1], 1000]]; records = FoldList[Max, path]; ListPlot[{ path, records }] ...
• 70.8k
Accepted

### RandomPoint inside mesh for walk-on-spheres Monte Carlo PDE solver

Thanks to Henrik Schumacher I got this to work with NestWhileList and visualized the walk on spheres. The other outputs of ...
• 25.6k
Accepted

### Animating a random walk of 3D water molecules?

all the molecules have the same orientation at any time, and I think I see why Because at each timestep you are are computing only a single angle and using it to rotate every molecule. In this ...
• 69k

### Survival Probability for Random Walks

We can do this using an implementation of FoldWhileList. First, implement FoldWhileList using this great answer. ...
• 13.1k
Accepted

### Driving a system of differential equations with an AR1-Process

You need to use RandomFunction[ItoProcess[]] instead of NDSolve. The syntax is a frustratingly a little different than ...
• 20.3k

### Record Statistics for Discrete Random Walks

Let's generate data from a random walk first SeedRandom[42] walkdata = Accumulate[RandomVariate[LaplaceDistribution[0, 1], 100]] , then one way to get what you ...
• 8,834

### What is this this application of KalmanEstimator doing?

First consider the response of the antenna to a sinusoid. The response is attenuated and has a delay. (This can also be seen from the BodePlot, if need be.) ...
• 8,776
Accepted

### Joint Moments of Stochastic Process at Different Times

You can use Expectation: ...
• 27.3k
Accepted

### How to generate Markov chains with given length and end state?

A random transition matrix for a 6-state Markov process: SeedRandom[1234]; T = Normalize[#, Total] & /@ RandomReal[{0, 1}, {6, 6}]; Calculate the ...
• 48.3k

### Need to calculate total distance traveled in a 2D random walk

SeedRandom[1] s = 0; path = Table[s += RandomReal[{-0.5, 0.5}, 2], {100}]; You can use ArcLength or ...
• 398k

### Survival Probability for Random Walks

It seems to me that this is a problem to which Catch and Throw can be usefully applied. ...
• 108k

### How do I create a random point on the surface of a cube?

We simply need a MeshRegion that represents the boundary of the unit cube. Then we apply RandomPoint to it. The following shows ...
Accepted

### Is there a way to generate a data-driven Monte Carlo sample from a histogram?

You may do this using "SmoothKernelDistribution". Here is a simple example. We first create some data from a Normal Distribution: ...
• 53.1k

### Is there a way to generate a data-driven Monte Carlo sample from a histogram?

This is precisely what RandomChoice does: choosing numbers according to weights. For example, if your histogram is ...
• 48.3k
Accepted

### Plotting Individual Variables from RandomFunction

As J.M. stated in the comments, sample["PathComponents"] allows me to isolate the variables.
• 419
Accepted

...
• 5,093

### How to use first time generated randomly matrix?

You might be looking for memoization: V[i_, j_] := V[i, j] = Table[RandomInteger[{-10 i, 10 j}], {3}, {3}]
• 30.2k

### How to use first time generated randomly matrix?

You can call your function once to generate the matrix, and store the result in a different variable... ...
• 8,751

### How to simulate a random walk to randomly generated particle to another particle fixed at the center of a grid?

This is like what you described, except that I also made sure that the particle didn't wander outside of the region $-100 \leq x, y \leq 100$ to ensure that convergence wouldn't take too long. ...
• 70.8k
Accepted

...
• 398k
Accepted

### Reverse graph generation

Using IGraph/M, to check if a degree sequence is graphical (i.e. if there's a simple graph with that degree sequence): IGGraphicalQ[degseq] To generate a single ...
• 236k

### Combine WienerProcess and WhiteNoiseProcess

Which part of the IMU are you trying to simulate...just the signals of ax, ay, az, gx, gy, gz? Or Maybe them fused together to get an angle of some kind? You didn't post all of your code, so I can't ...
• 2,991

### Ito Process sourced by Gaussian Process?

It is not a solution, but some comparison two different approach to the same problem (oscillator with random force). What we expecting from ItoProcess in this case? ...
• 45.8k

### How can I improve this code?

First, get rid of AppendTo and replace it with a preallocation of the array because you know the size in advance. Second, use ...
• 27.3k