# Questions tagged [random]

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

690 questions
Filter by
Sorted by
Tagged with
29 views

### Help with evaluation of the differential of a BSplineFunction?

It can be useful to generate a smooth random function over $[-L,L]$ with BSplineFunction: ...
51 views

### RandomPoint returns compiler errors on RegionIntersection of two Meshs?

Consider the intersection of two ConvexHullMesh's, m1 and m2. ...
101 views

### Parallel evaluation of RandomVariate for an InterpolatingFunction

I need to generate a lot of point according to a given distribution. I don't have an analytic form of this distribution so I am using an InterpolatingFunction of ~100 points computed numerically. I ...
561 views

### Generating random, non-repeating points on the plane

The problem is to generate random points on the plane that are unique (i.e. no repetition of a point). The following won't work because of repetition: ...
69 views

### Why does SeedRandom with same seed used twice produce such different results?

I have occasionally used RandomSeed twice in the code and noticed behaviour that I don't understand. Consider: ...
423 views

### How can I generate a sin wave with power law noise?

I am interested in simulating a signal with different types of power law noise, as entitled in wikipedia, "Color of Noise". (The audio examples are pretty cool). Basically, white noise, which many ...
112 views

### RandomVariate with ProbabilityDistribution performs well in 10.0, but not in later versions

I have a custom probability distribution function and I want to generate numbers according to this PDF. Interestingly enough, this works without trouble on my MacBook with Mathematica 10.0, but when I ...
104 views

### Random sampling of a discrete distribution in NetGraph

Within a NetGraph I would like to use the output of a softmax layer, interpreted as a probability distribution, to sample a "next token". Since this is done inside an RNN structure, I cannot do this ...
111 views

### Improving Speed of Binomial and Multinomial Random Draws

A number of users have discussed the speed of Random number generation in Mathematica. The Binomial and Multinomial random number generators in Mathematica are fast if multiple draws are needed for ...
154 views

### Generate a uniform distribution over an $n$-simplex employing quasi-random low-discrepancy points

This post is intended in a similar direction to an earlier one Can I use Compile to speed up InverseCDF? . I now wish to generate uniform points in an $n$-simplex (specifically $n=8$), making use of ...
125 views

### RandomReal in combination with NormalDistribution [closed]

I am normally not working with Mathematica, but I have to understand a code written in i! Can some body say what the arguments and parameters of code below say? ...
60 views

### Parametric Ito Process

Is it possible to make a parametric ItoProcess ? I'd like to write that equation : ...
53 views

### Ito Process with Piecewise

I have the following ItoProcess : ...
31 views

### Computing the same stochastic ODE many times but with different random seeds

I have this stochastic ODE, where I'm using ParametricNDSolve and WhenEvents : ...
143 views

385 views

### Finding the dangling free part of a cluster connecting two nodes

I am trying to learn how to use Mathematica for analyzing graphs, more specifically in the context of connectivity and percolation. For the sample graph that I have included in this post, we have a ...
555 views

### Graphing random points on the XY-plane

I am trying to generate around 10-20 points on the xy- plane in the domain $[-10,10]\times[-10,10]$ (in 3D) and I am having trouble. I want to draw the plane in 3D, graph the random (they do not have ...
103 views

### Monte Carlo simulation using modified rejection technique

Plot the probability density function $\qquad w(x)=(1/(1+x^2))(1/x^{0.5})$ for $(0 < x < 1)$ Make up the subroutine flowchart to get the random numbers $x$, using the modified ...
196 views

### How to generate a matrix with certain conditions

I want to generate a $n \times n$ matrix. I want the diagonal entries to be all 0 I want a random choice of matrix elements with 0 or 1. The probability of having a 1 as a matrix element is $1/m$ and ...
72 views

### Perpendicular chord lengths from the boundary points of an arbitary 2D shape

Let's generate an arbitrary convex domain with smooth boundaries: Graphics[BSplineCurve[{{1, 4}, {5, 3}, {9, 4}, {5, 5}, {8, 7}}, SplineClosed -> True]] I'...
449 views

### On random numbers extracted from NormalDistribution by two different methods under the same seed

I've encountered the following situation within various trials. Why does such a difference arise between bulk sampling and one-by-one sampling? ...
294 views

### Trying to compute the heat capacity for the 2D-Ising model

I'm trying compute the heat capacity $C_v$ out of my simulation for the 2D-Ising model which is given by $C_v = \frac{\langle E^2 \rangle - \langle E \rangle^2}{T^2N^2}$ ($E$: Energy, $T$: ...
1k views

### Sisyphus Random Walk

A Sisyphus Random Walk evolves as follows: With probability (r) you advance the position of the walker by +1. With probability (1-r) the walker resets at x0 = 0. To simulate the probability of reset ...
50 views

### How to take a point randomly from a region [duplicate]

I want to take some points randomly by the limits above, I had try to use FindInstance method but it always out (0,0) ...
1k views

### Survival Probability for Random Walks

The Survival Probability for a walker starting at the origin is defined as the probability that the walker stays positive through n steps. Thanks to the Sparre-Andersen Theorem I know this PDF is ...
141 views

### Controlling the randomness of DropoutLayer

How can I control the randomness of DropoutLayer in order to get the same result after each execution? For example: ...
189 views

### Obtain the current value of the seed used by the random number generator

I would like to be able to do something like the following pseudocode: ...
953 views

### Generate Random Symmetric positive definite matrix

Is there any way to create a random symmetric positive definite matrix ?
976 views

### Random Six Character Strings Without Collisions

I want to generate a random list of six characters that only contain characters from "0...9" and "A...Z". For this I can define ...
312 views

### Record Statistics for Discrete Random Walks

I code a random walk of length 100 drawn from a LaplaceDistribution: Accumulate[RandomVariate[LaplaceDistribution[0, 1], 10000]] I am having trouble counting the ...
114 views

### Sampling data from numerical values of density distribution of nucleons

How could i sample my data which follows distribution if i have only numerical values of density distribution as an example data attached as in picture I tried but do not know how to do it. The data:...
89 views

### 2d-RandomWalks with N steps and fixed distance between first and last point

community, I'm trying to figure out a way how to create a 2d list simulating a N-Step-Randomwalk with a fixed distance between first and last point. I already got the RandomWalk with the step size 1: ...
89 views

### Random number generation within Compile and Parallelization->True

According to this thread RandomChoice is a compilable function. I use it to generate random numbers in a compiled function with parallelization enabled. I wrote ...
467 views

### Randomly distribute numbers to lists

I have 4 empty lists. I would like to randomly distribute numbers from 1 to 10 to these 4 empty lists. How can I add integers to lists randomly? For example: ...
372 views

### Sum of Random Integers

I am trying to get a list of numbers with at least 1000 sums as possible, using random numbers from 1 to 10. But I don't want to get blank list output. How can I only get a list of numbers greater ...
40 views

### How to create 2 lists of RandomIntegers based on condition?

How do i create 2 lists of RandomIntegers that are the same at certain points based on a condition. For example there are three lists: List A List B List C List C already exists. I am trying to ...
99 views

### How to match random number generator to R?

Although I know the algorithm that R is using for pseudo-random numbers I am unable to match the generation of random numbers. ...
301 views

### Generate a smooth random function (2D curve) with endpoints specification?

Here is a PDE example, adapted from Wolfram Documentation: ...
67 views

### Drawing random numbers from TransformedDistribution

Suppose I have created the following TransformedDistribution: ...
73 views

### How do decrease uncertainty of Monte-Carlo integration?

I have some function of many arguments and need to integrate it over the region given by the products of Heaviside theta functions. Namely, I write, say, ...
173 views

### How to select random number of elements from a list?

Assume that I have a list a = {1,2,3,4,5,6}; and I want to have a function that outputs a subset of the list such that with probability p=0.2 each element will ...
75 views

### Random points from an image using a BernoulliDistribution

I am a Mathematica newbie. I need to sample random points from an image which I have stored in a variable img as: ...
188 views

### Why does Monte Carlo integration underestimate my integral as integration range increases?

I'm having a huge problem with Monte Carlo integration. This simple example adequately shows the problem. ...
50 views

### Matrix Randomization

Is there a way to take a 20x20 array and replace 2 random parts of this array with a 2x2 matrix? I've tried rvalues = ConstantArray[r, {20, 20}]; to make the ...