# Tagged Questions

Questions about random number generation and the properties of numbers so generated.

2answers
337 views

### Spacing out random walks so they don't overlap

From an external simulation program, I have lots of particle tracks which follow random walks, all of which start at or near the origin $(0,0)$. This means that when I plot the walks in Mathematica, ...
0answers
47 views

### Randomly generate a list of arbitrary length from a finite set [closed]

I have a finite set of elements (5 to be exact). Suppose the first element has probability $\frac{1}{2}$ of being selected, while each of the others has probability $\frac{1}{8}$ of being selected. ...
3answers
168 views

Observe: ...
0answers
19 views

### Creating points that are remoted from one another beyond a certain threshold. Quasirandom sequance? [duplicate]

I am looking for an approach to create a set of pseudorandom pairs of numbers subjected to one condition. They must be not closer to one another than a certain limiting parameter. One approach might ...
1answer
116 views

### RandomPoint in geographic region from Polygon[region_]?

How do you generate a RandomPoint in a geographic region? ...
0answers
73 views

### Restarting random number generators where you left off

I have code that uses both RandomReal and RandomInteger a number of times to produces a sequence of $n$ data sets. After ...
1answer
183 views

### Why does't SeedRandom work here?

From the docs on SeedRandom, SeedRandom[] resets the generator, using as a seed the time of day and certain attributes of ...
2answers
486 views

### Implementing the PCG random number generator

PCG ("permuted congruential generator") is a recently-introduced random number generator. PCG is a family of simple fast space-efficient statistically good algorithms for random number generation. ...
1answer
34 views

### Variable Definitions and Random Numbers [closed]

I have currently created the following matrix: m={{RandomReal[{0,1}],RandomReal[{0,1}]},{RandomReal[{0,1}],RandomReal[{0,1}]}} In other words, a $2 \times 2$ ...
2answers
161 views

### Possible bug in VonMisesDistribution?

Bug introduced in 10.2 or earlier and fixed in 10.3 Observe: ...
1answer
70 views

### How to repeatly use random number generator in optimization problem

I am looking to run the optimization problem. I already finish my optimization code as below. ...
0answers
45 views

### Mixture of a bivariate distribution defined as a copula

I define a bivariate distribution: ...
1answer
113 views

### Random variable within Manipulate: how to make it independent on other controls

The code sample: ...
3answers
116 views

### ImplicitRegion gives arbitrary boundaries

This question uses Mathematica 10.2.0.0. equation1 is the major unbounded region I would like to generate: ...
2answers
368 views

### How do I generate n random numbers with an extra condition [duplicate]

I need to generate n random numbers that would sum into a. And I can't find an elegant solution here: ...
3answers
528 views

### For loop in Length computation code

Here is a code I wrote that is supposed to give the length of list after some splitting and regrouping. But it is inefficient. Is there a way to rewrite in more professional and efficient way? I guess ...
2answers
148 views

### How to find an estimated root efficiently with binary stochastic estimation of the function?

I am trying to construct certain nice geometric patterns, and one particular feature I'm trying to optimize is the balance of black and white corresponding to point being inside, or outside a ...
3answers
281 views

### Random non-overlapping disks in a square

I've found a nice code snippet by @belisarius from this question, that I'll reproduce here for reference: ...
1answer
77 views

### How do I define a random variable involving Part?

I need to define a random variable that involves Part, but when I try, for example ...
1answer
562 views

### What function generates random numbers in a compiled function?

I am writing a simulation for 2D random walk. I wrote several version of code, and found that the speed is like this (fastest to slowest): C++, Mathematica compiled procedural code, Mathematica ...
0answers
110 views

### Retrieving forthcoming step size from NDSolve

I'm solving a system of ODEs with a random component, which changes at each calculation step and depends on the step size. So I'm trying to realize something like this: (1) size of the forthcoming ...
1answer
96 views

### Slow-down encountered for RandomChoice in large lists

I was wondering if anyone could help me to speed up this code snippet which creates simple (sparse) networks by preferential attachment. The algorithm adds a vertex and an edge each time interval. ...
2answers
93 views

### Better to use loop or function when populated list?

In the past I have pretty much stuck to expression building when using Mathematica, but recently I have been writing a procedure to populate an array, which I guess are called "lists" in Mathematica. ...
3answers
127 views

### Partitioning List Into Sublists of Length 2 With The Pairing Being Random

I've done a bit of Googling with hopes of finding an answer, but to no avail. I'm looking for a way that I can have Mathematica take the elements of a list, say ...
1answer
312 views

### Plotting random circles in a square

How can we draw 20 circles which have random radius in a specified range, with random positions. All centers must be in a square with side=10 (for example centimeter): every overlapping between any ...
1answer
69 views

### RandomGraph with specific constraints

I need to generate random connected simple graphs (no loops) with the constraint that exactly two vertices must only have a single edge. I can create many connected graphs (but very few will have the ...
1answer
212 views

### Regime Change Stochastic Process

I would like to simulate an Ito process in which the drift and diffusion terms change after hitting a boundary for the first time. For example, a Geometric Brownian Motion X which has 0 drift and ...
2answers
714 views

### Simple Monte Carlo simulation

I want to find the Monte Carlo simulation of the integral $$\int_0^1 \sqrt{1-x^2}\mathrm dx$$ The Cesàro mean is $$I_n=\frac1n\sum_{k=1}^{n} f(U_k)$$ I want to plot the scatter plot ...
2answers
83 views

### Calculating Variance (without Variance expression)

I am learning Mathematica on the fly, one of my tasks is to find the variance of white noise. I followed the tutorial for finding white noise by using the code: ...
2answers
624 views

### Generating uniform random points over a binary image

So I recently read this excellent post about generating random points over arbitrary regions. I hope Wolfram eventually builds that functionality into Mathematica's Random functions. I want to do this ...
2answers
323 views

### What's wrong with NIntegrate with “MonteCarlo” Method?

Bug fixed in version 10.2.0 My code is: ...
3answers
248 views

### How do I draw random points from a region [duplicate]

as the title,this problem have confused me a whole day.If I have a region,how can I yield a random member in this region.The region such as ...
2answers
116 views

### How do I execute a block of code multiple times? [closed]

Rudimentary pseudoconceptial question: I have a specific block of code that uses random variables and generates a plot at the end based on random code. I want my code to run 10 different times to get ...
0answers
45 views

### Parametrizing a matrix given its trace and norm

I have a problem where I have to generate random matrices with the following properties: ($a$ is a given fixed number) $\mathrm{Tr}\, A=0$ $\mathrm{Tr}(A^\dagger A)=\|A\|_F^2=a$ I was wondering ...
2answers
150 views

### Generate a list with random values between a and b [closed]

I am trying to perform system identification.. To properly identify the system i have to give the system a "rich" signal which are able to "activate" all the modes of the plant. A rich signal would ...
0answers
44 views

### Custom graph distribution

I am working with random graphs a lot. It's quite easy to describe random graph using, adjacency matrix or just a list of edges. However I am thinking that I might benefit from describing random ...
1answer
83 views

### usage of random numbers in recursive loop

I am trying to evalute two functions using iterative process as below ...
1answer
387 views

### Generating animations of clouds with Mathematica

I'd like to generate some visually-pleasing animations of clouds, fog or smoke with Mathematica. My idea of "visually-pleasing" is along the lines of one of the images on the Wikipedia article for ...
2answers
347 views

### How to generate a random, relatively prime number to p?

I'm sorry if this is an obvious question, but I'm a newbie and googling didn't help me much. Is there a way in Mathematica to generate a number q coprime with ...
3answers
82 views

### Fill an array, symmetric with respect to its centre

I want to create an array that must be symmetric with respect to the centre of it, as in the following example: 0 1 2 3 4 3 2 1 but, instead of having such ...
1answer
67 views

### How do I apply a conditional append rule to plot randomly chosen points?

I'm working on an attempt at forming a sort of "Mandelbrot" set using Newton's method and randomly chosen points. Effectively I need to define a loop for Newton's method to determine whether my points ...
3answers
444 views

### Turning a set of random walk data 45 degrees

I have a set of data that is just a "random" (generated by me, not by computer) sequence of length 2000 of 1's and (-1)'s. I used it to plot a 1-D random walk where +1 is step up, (-1) is step down, ...
1answer
226 views

### Combining Mandelbrot and Monte Carlo

I'm trying to combine plotting a Mandelbrot set with Monte Carlo randomization to plot an equation using random points for complex number z, for the function $z^3-2z+2=0$. Below is the code I have ...
2answers
244 views

### Finding uniformly distributed random points on an ellipsoid

I am trying to generate a poincare map for a system whose reduced energy manifold looks like the following surface. (x/a)^2 +(y/b)^2 +(z/c)^2=1 I want to find a ...
3answers
428 views

### Simulate random data with correlation

I would like to simulate some random data e.g. between 0 and 1, but with a given correlation. In other words some data where the correlation between two datasets is e.g. a constant or within a give ...
0answers
102 views

### RandomVariate, MSE and Cramer-Rao bound calculation

I'm using the following code to plot the variance of a moment estimate of a parameter of Rice distribution and its' Cramer-Rao bound. First I generate $10^3$ vectors $\texttt{R}$ ($10^3$ elements ...
1answer
256 views

### Random numbers in C++ and Mathematica gives wrong results? [closed]

I have the following strange phenomenon which puzzles me!: I have a piecewise constant probability density given as ...
1answer
179 views

### Failed to create a special random-disturbed initial condition for partial differential equation [closed]

I try to use BSplineFunction to creat a initial condition for NDSolve which has periodic boundary condition, that is realized by ...
1answer
157 views

### Generate a small random disturbance on a flat surface for NDSlove

I want to generate a small random perturbation on a flat surface defined on a square domain, e.g. 1 + 0.05 rand(x,y), which can be used as initial condition with periodic boundary conditions in ...
2answers
54 views

### Simulate from an AR(1) process where the parameters vary over time

I would like to simulate from an AR(1) process, where the $\rho$ parameter in the process of the form: $X_t = \rho X_{t-1} + \epsilon_t$ varies over time. The path of $\rho$ and $var(\epsilon_t)$ ...