Tagged Questions

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

learn more… | top users | synonyms (1)

2
votes
1answer
64 views

Is random number generation based on Farlie-Gumbel-Morgenstern copula wrong?

I am constructing a bivariate Farlie-Gumbel-Morgenstern distributions with Normal and exponential marginal as follows: ...
4
votes
2answers
67 views

Generate non-overlapping permutations

Let l be a list l = Flatten[Range[7] & /@ Range[12]]; (* 1,2,3,4,5,6,7,1,2,3,4,5,6,7,... *) The question is to ...
0
votes
2answers
54 views

A constraint to RandomReal for sum of numbers equal to arbitrary n

I want to generate some random numbers but respect a constraint. So I use RandomReal[{0,1},N,WorkingPrecision -> 2] I want to fix a constraint in order ...
24
votes
2answers
335 views

Assign a randomly generated list to variable

Bug introduced in 10.0.0 I don't know if this is a silly question, but it really baffles me. So please help me understand this behavior. ...
1
vote
1answer
58 views

How to figure out the seed I used to generate several random numbers given that I didn't used SeedRandom at first place?

After generating thousands of random numbers, I figured out that I didn't used SeedRandom to store the seed. Is there a way for me to know what seed was used to generate these numbers? Thanks in ...
1
vote
1answer
95 views

Generate random nxn matrix with all negative eigenvalues

I need to generate an nxn matrix with random entries, but I also need all of the eigenvalues to be negative (real or complex doesn't matter). I have: ...
0
votes
1answer
53 views

Why does RandomFunction return variable number of data points?

I am using the following code snippet to generate Compound Poisson process random numbers: ...
2
votes
3answers
289 views

Coloring random points in an annulus

I have found the following random generator to generate points in an annulus in stackoverflow on stackoverflow ...
2
votes
2answers
88 views

How to randomly partition a range [closed]

I need to create a partition of a list of integers from $1$ to $n$ into a number of partitions of different size, with the constraint that the total number of elements in the partition must equal $n$. ...
8
votes
3answers
292 views

Random Integer Sequences

I want to construct a random square matrix in the following manner: a) Three states [0 | 1 | 2] are repeated ...
1
vote
2answers
89 views

Verify positive definiteness using random numbers

I wish to verify whether T'T - IdentityMatrix[2] is always positive definite for a certain choice of elements of T'T. ...
2
votes
2answers
257 views

How can I get this sum? [closed]

I want to sum the following numbers. At present I am calculating my sum as follows. a = 10^20 + 10^30 + 10^40; In the above case, if I want to add 100 or more ...
2
votes
1answer
51 views

Parallelization and evaluation of random number generation

Suppose I have the following functions: ...
4
votes
1answer
150 views

Generating random symmetric matrix

Suppose first that I want to generate a matrix whose elements are i.i.d. with distribution dist. This is easy: ...
3
votes
2answers
95 views

Sublists of Random Permutations

What is an efficient way to create a list of (psudo)randomly chosen permutations? I'm trying to create a list like below: ...
0
votes
0answers
36 views

Is there a reliable way to compute the Hurst Dimension of a time series [duplicate]

The Mathematica function FindProcessParameter exists but may be unreliable: FindProcessParameters for Fractional Brownian Motion Returns Error Is there a simple algorithm that can be done in ...
1
vote
1answer
56 views

FindProcessParameters for Fractional Brownian Motion Returns Error

I have the following data: ...
3
votes
1answer
73 views
5
votes
1answer
176 views

Computing the Hurst exponent or fractal dimension of fractional Brownian motion

The Hurst exponent is related to the fractal dimension by noticing that the fractal dimension $D$ is equal to $2-H$, where $d$ is the intrinsic dimension and $H$ is the Hurst exponent, for 1-D ...
0
votes
0answers
58 views

How to deal with matrices involved in system of SDEs?

This question is in continuation of the the previous posts Solving Stochastic differential equation and Fast Simulations with Compile. What I want to do is numerically solving the epidemic model which ...
12
votes
6answers
456 views

How to generate random points in a region?

The Mathematica 10 documentation was updated for FindInstance adding support for regions. In my use case I'm trying to sample points in a set of disks: ...
23
votes
5answers
2k views

2D random walk within a bounded area

I want to simulate a random walk on two dimension in a bounded area such as a square or circle. I am thinking of using If statement to define a boundary. Is there a ...
1
vote
3answers
125 views

Random reals according to conditions

I'd like to create a list of triplets $(x,y,z)$ which satisfy the following properties: $$0<x<1/2 \\ 0<y<1/2-x \\ -1<z<-2(x+y)$$ Basically I would like to uniformly generate random ...
15
votes
1answer
289 views

Speed up adding Poisson noise to an image

I'm simulating some images corrupted with Poisson noise, but I'm encountering a few problems with performance. According to the documentation on ImageEffect, one ...
0
votes
0answers
43 views

Random reals according to probability distribution [duplicate]

How do I generate a list a random real numbers that follow a probability distribution? If my pdf is $f(x)$, how do I "force" the random numbers to follow $f(x)$?
2
votes
3answers
279 views

Create a list of random reals

How can I create a list of random pairs $(x,y)$ where $0<y<x<1$ and $x,y \in \mathbb{R}$ ? I can't seem to place that inequality restriction on the random numbers that are generated.
0
votes
0answers
30 views

Generating a Table with a certian Density [duplicate]

How do I create a random table of 0's and 1's with a certain density instead of a probability? For Example: Manipulate[ Table[RandomChoice[{1 - density, density} -> {0, 1}, {10}]], ...
0
votes
1answer
93 views
5
votes
4answers
1k views

Random numbers that sum up to specific value

I would like to generate a list with random numbers, which add up to a specific value. While[Total[x] == 28, x = RandomInteger[{0, 28}, 5];Print[x]] The random ...
0
votes
1answer
114 views

Generate Random 3D Network using GraphPlot3D and loop

Instead of writing all this out I want to do the same thing with a loop and be able to manipulate n and k. The idea is to create a randomly generated network where n is the number of nodes and k is ...
0
votes
1answer
69 views

Probability Distribution of a Multivariate Hypergeometric distribution and maximum probability

Hello to all Mathematica Users! I have this question: Consider a box which contains 69 balls. 17 red, 1 white, 29 blue and 22 green balls. There will be picked 7 balls randomly, without putting the ...
3
votes
2answers
212 views

Addition of Matrices [closed]

How can I add the Matrices created by this: SeedRandom@0; Table[RandomInteger[{0, 34}, {2, 2}], {2}, {5}] // MatrixForm $\left( \begin{array}{ccccc} \left( ...
4
votes
3answers
126 views

Creating nested matrix using random integers

How do i create 15x2 matrix with 2x2 random integer elements? My code only returned identical 2x2 elements:
3
votes
1answer
152 views

How to generate a random binary tree with a given number of vertices and with a given shape, namely compact or elongated

I tried to generate a random binary tree with a Table of RandomInteger and to give a shape with a ...
4
votes
4answers
565 views

Skip other If conditions

I'm trying to write a code to "random" move in a matrix but it can't go to a certain position if it has a certain value (in this case I'm using the number 2). How do I make it to skip all other If ...
3
votes
1answer
154 views

Simulating a bounded continuous random walk in $n$-dimensions

You're given three $n$-dimensional real vectors, $\mathbf{x_0}$, $\mathbf{a}$ and $\mathbf{b}$, with $\mathbf{a} \le \mathbf{x_0} \le \mathbf{b}$ (vector inequality means component-wise inequality). ...
2
votes
1answer
126 views

Plot A Function Of A Stochastic Process

I am trying to do something very simple in Mathematica 9. I want to play around with option pricing and for that I thought it best to use the new stochastic process functionality. So, first of all I ...
1
vote
1answer
83 views

How to generate a random signal consisting of the specified functions

Let's assume that I have some particular signal on the finite time interval which is described by function $f(t)$. It could be, for instance, a rectangular pulse with amplitude $a$ and period T; gaus ...
1
vote
1answer
127 views

Matrix and random, weighted assignment of rows

I asked a question in this category previously but my problem has changed. On one hand, I have a large number of data files as .dat format, and on the other hand, I have a matrix ...
2
votes
2answers
139 views

Generating $n$ random samples every time

Is it possible to generate $n$ random samples, and always ensure that $n$ samples are generated? eg For $n=5$: ...
1
vote
4answers
219 views

random split a dataset

I've got a very simple problem, but not so trivial. I need to split a dataset (input and output data) in three part randomly: training set 70%, validation set 20% and is test set 10%. First of all ...
1
vote
1answer
50 views

Replicability of RandomVariate within a function?

I have a rather basic question but can't figure out a foolproof answer. In the following code, I build a function which returns the mean difference between successive elements of a vector created from ...
0
votes
0answers
30 views

Table of values for functions with random variables [duplicate]

I'm trying to get a table of values for functions with random variables. First of all, i have a function like that: ...
6
votes
2answers
640 views

Distribution of 10 points within a unit square

Related to some packing problems, following problem arose: Distribute 10 points within a square of sides 1, so that minimal distance between them is maximized. With the help of random simulation, or ...
0
votes
1answer
70 views

Importing a text file into a matrix format

I am attempting to perform a comparison of pseudorandom number generation with the RAND Corporation's "A Million Random Digits with 100,000 Normal Deviates" for a Computational Physics course. I have ...
1
vote
3answers
146 views

How do I select only those lists whose elements are all above a certain number?

I'm essentially doing coin flips, using RandomReal to populate a bunch of lists, each with 8 elements. I then want to select only those lists for which all elements are greater than a certain number, ...
2
votes
2answers
193 views

Expectation of a family of random variables

I did some search here, but seems that no one asked about this. I want to define a family of independent and identically distributed random variables, $x_1,...,x_n$, and then calculates the expected ...
3
votes
1answer
56 views

RandomVariate does not evaluate a Hyperbolic Distribution

Any Idea why I can't get a result from this expression: ...
0
votes
1answer
95 views

How to efficiently distinguish the rewired edges in WattsStrogatzGraphDistribution?

The WattsStrogatzGraphDistribution function is a way to construct random graphs based on Watts and Strogatz small world model. The ...
3
votes
5answers
198 views

Randomly selecting and reinserting a subset of elements in a list

This question is similar to my other question: How do I randomly select 'k' positions in a list and shuffle their respective elements without effecting the other elements? Imagine first a ...