# Questions tagged [random]

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

812 questions
Filter by
Sorted by
Tagged with
68 views

### Sum of elements products equals to zero

I need to evaluate $\sum_i a_i b_i=0$, subject to the constraint $\sum_i a_i=1$. For the "a" summation being equal to 1, I generated a random list of 10 elements using ...
1 vote
89 views

### While inside a function body does not work as expected [closed]

I'm trying to write a function that return a randomly created rational polynomial function that has a discontinuities points. I already have a function that generates random rational polynomial (...
458 views

### How do you generate a random number with a pre-specified probability distribution?

I want to generate a random real number between 0 and 1 but not distributed uniformly but with a probability distribution say, 2 Sin[ pi x ]^2 which integrates to 1 ...
329 views

...
115 views

### How to generate random dots with given distances?

I am interested in the following problem, and am curious if Mathematica could be used to solve it. I start with a radius function $\rho:D\to \mathbf{R}_{\ge 0}$ on a region $D\subseteq \mathbf{R}^n$. ...
1 vote
72 views

### How to run multiple random process and plot its average for a non-autonomous logistic model?

This problem is a continuation of the discussion from here, with random impulse function as discussed in here to formed the following: ...
38 views

### Spanning Subgraphs of random sizes with probabilities on edges

I need a way of taking some graph G and obtaining a spanning subset of G where each edge $e_i$ has some probability $P_i$ of being in the subgraph. So the size of the edge sets of each random subgraph ...
58 views

### Random Variate inside a function causing the function to behave unexpectedly

I define a Random Variable drawn from a custom probability density. ...
256 views

### How can I rotate a cube uniformly?

Background Alice, Bob, and the average shadow of a cube I use the following code to simulate this experiment, ...
139 views

### How to shuffle just one column of table/list?

I have a list in form {{X1,Y1,type},....{Xn,Yn,type}}. X and Y are coordinates and type is a number between 1 to 15, the length of the list is 12000, so I can not upload the data here. I need to keep (...
146 views

### RandomReal vs Random[Real

Let's say I need random numbers with increasing precision to simulate a particular function, so I try: ...
446 views

### Generating a matrix with specific number of 1's in every row and column

I would like to have a function f(n,k) that generates a random nxn matrix with k elements equal to 1 in each row and column and has an all-zero diagonal, with all other elements equal to 0. In other ...
93 views

### Verifying probabilities equality by imposing conditions

I'd like to verify the following equality in Mathematica: $$P(Z_1+Z_2=2,Z_1=1,Z_2=1)=P(Z_1=1,Z_2=1)$$ by knowing that $Z_1,Z_2 \in \lbrace 1,2,3,4 \rbrace$ are two independent and uniform random ...
50 views

### How to create a real number generator whose value is persistent between kernel restarts?

Suppose I have a function f[x_] := RandomReal[] If I set x_=2 and f=.2134.., I want <...
257 views

### Optimizing sequential computation

The following question came up in reading group discussion of paper -- imagine taking two vectors, multiplying each by a random matrix, then taking tanh pointwise. If you repeat this process forever, ...
71 views

EDIT-1 This is a minimal example where an error occurs after 44538 samples generated in d1 upon importing as d2. Note that if <...
1 vote
40 views

### How to generate a Gaussian random velocity field

Let us assume we have a 2-dimensional velocity field $\textbf{u}=(u_x,u_y)$ defined via its stream function $\psi(\textbf{x})$ as \begin{cases} u_x=\partial_y\psi(\textbf{x}) \\ u_y=-\partial_x\psi(\...
1 vote
37 views

### Help request understanding the use of SeedRandom [closed]

I want to use SeedRandom inside of a code in which I use SmoothKernelDistribution to obtain the pdf of a stochastic process at a determined time as ...
78 views

### random choice of multiple lists but delete element chosen

I want to make a function which takes lists as an input and outputs one element out of one of the list with uniform probability (if for example we have 2 lists, one with 7 and one with 3 elements, ...
270 views

290 views

### Generate 3 dimensional random vectors

How can one generate a random vector $v=[v_1, v_2, v_3]^T$ satisfying $\sqrt{v_1v_1^* + v_2 v_2^* + v_3 v_3^*} = 1$, where $T$ and $*$ denote the transpose and complex-conjugate, respectively?
150 views

### How to throw $n$ random noodles of equal length?

I've been meaning to modify some code given in the the Region Disjoint documentation for the Buffon's Needle problem to instead model Buffon's Noodle Problem. In Buffon's Needle problem you randomly ...
85 views

### Multinomial Distribution Sampler not working

I am trying to sample from a multinomial distribution many times but with a different multinomial distribution each time. The straightforward ... 