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

learn more… | top users | synonyms (1)

28
votes
6answers
2k views

Efficient way to generate random points with a predefined lower bound on their pairwise Euclidean distance

Using Mathematica what is an efficient way to generate a list of $n$ random two dimensional points $\{x_i,y_i\}$ where $i=1,...,n$ so that no two points $p_1$ and $p_2$ in the list has an Euclidean ...
23
votes
1answer
1k views

RandomVariate from 2-dimensional probability distribution

A probability distribution can be created in Mathematica (I am using 8.0.1) with e.g. ...
33
votes
5answers
2k views

Distribution of random points in 3D space to simulate the Crab Nebula

I'm generating some 3D models of planetary nebulae and supernova remnants for Celestia, a free OpenGL astronomy software. Currently, I know how to do it with random points inside a spherical shell. ...
16
votes
1answer
410 views

Simulating Theatre puzzle

I have been trying to simulate the process of the theatre puzzle from the Joy of X (Strogatz). The puzzle, and some relevant material are here. My simplistic coding for this process follows: ...
9
votes
3answers
2k views

How to generate a RandomVariate of a custom distribution?

I'm trying to generate a pseudorandom variate out of a custom distribution. Suppose I want define a custom distribution, and for the sake of simplicity I define a Poisson distribution (the ...
16
votes
4answers
2k views

Efficiently generating n-D Gaussian random fields

I am interested in an efficient code to generate an $n$-D Gaussian random field (sometimes called processes in other fields of research), which has applications in cosmology. I wrote the following ...
8
votes
3answers
1k views

Randomly packing spheres of fixed radius within a cube

How can I have Mathematica randomly place spheres in a cube so they won't overlap? The cube is $20 \times 20 \times 20$, and the spheres have a radius of $0.7$.
34
votes
3answers
1k views

Quality of random numbers

Mathematica has several ways of generating random numbers: Congruential, ExtendedCA, Legacy, MersenneTwister, MKL, ParallelGenerator, ParallelMersenneTwister, Rule30CA. For ...
25
votes
1answer
871 views

Finding the likeliest path in a Markov process

With Mathematica 9, we have the addition of various processes, among which the discrete Markov process. Given a transition probability matrix m, such a process is ...
6
votes
5answers
1k views

Vectors with a certain magnitude in Mathematica

For a user specified magnitude, is there a way to have Mathematica produce any 3D vector that fits that magnitude?
3
votes
1answer
152 views

Sample of the random times at which the random walk crosses the boundary

I defined a security boundary for a random walk: ...
2
votes
5answers
573 views

Assigning a particular value to array elements

I have an array of 10000 elements. I want to randomly assign energy to these 10000 elements using Gaussian or Exponential distribution, such that each time a particular element is selected its energy ...
22
votes
4answers
429 views

obtaining random element of a set given by multiple inequalities

I try to obtain random elements from a set given by multiple inequalities. This is of general interest to me, but let me present one example here: I have multiple inequalities specifying half spaces ...
14
votes
5answers
782 views

Picking random items out of a list only once

I'm trying to create a function that randomly returns a value from a list but remembers the values that have been given before. At the end when the list is empty it should return an empty list. ...
11
votes
2answers
429 views

Fast Simulations with Compile

this post relates to another post that I didn't follow up propely. If I wanted to simulate a system of stochastic proesses like the following, and loop over this run many many times would writing the ...
13
votes
1answer
442 views

Which Distributions can be Compiled using RandomVariate

Recently, Oleksandr kindly showed a list of Mathematica commands that can be compiled. RandomVariate was part of that list. However, whether this can be compiled depends upon the distribution that is ...
1
vote
1answer
272 views

How to reject or repulse some points in a 3D cloud of particles?

I'm having an issue with a 3D distribution of points. The distribution is really nicely looking in Mathematica, but it is used in an OpenGL astronomy program (Celestia) to generate a nebula, with ...
1
vote
1answer
544 views

Add noise (random values) to data

I have a data set(x,y,z) corresponding to a hemisphere, to which I want to add some controlled noise (random values) to make the x,y,z values diverge. data = Flatten[ Table[{i, j, i^2 + j^2}, {i, ...
11
votes
1answer
283 views

Are there rules of thumb for knowing when RandomVariate is more efficient than RandomReal?

Please consider the following: From a fresh Mathematica kernel, RandomVariate is more efficient for NormalDistribution but ...
2
votes
2answers
149 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 ...
1
vote
3answers
148 views

Number theory: Problem involving rational numbers

Use RandomRat to test whether ((-1)^(1/Denominator[q]))^Numerator[q] is identical with ...
14
votes
3answers
860 views

Finding the volume of a sphere using the Monte Carlo algorithm

I used the following code to find the volume of the sphere $x^2+y^2+z^2 = 1$ in the first octant: ...
15
votes
3answers
673 views

Generate a Random Polygon

Does some package exist with a function that takes a parameter $n$ and generates a random 2D $n$-sided simple polygon (convex or non-convex), possibly within a certain bounding box? It does not ...
6
votes
4answers
968 views

3D Random Walk with Periodic Boundary Conditions

I am working on a 3D random walk with periodic boundary conditions and have written a program that will do this for me but it is extremely slow. Does anyone have any suggestions on how I could speed ...
19
votes
2answers
696 views

Efficient Generation of Random Variates from a Copula Distribution

I have a 7-asset portfolio for which I want to simulate daily log-deltas using a Student T copula. The marginal distributions are all either Stable or TsallisQGaussian. Using NMaximize, I have ...
14
votes
3answers
593 views

1D Random Walk variant

I am making a notebook that is a variation to the traditional 1d random walk problem. The normal 1D random walk can be simulated easily by ...
12
votes
1answer
429 views

Simulating discrete time stochastic dynamic systems

What is the canonical way of simulating discrete time stochastic dynamical systems in Mathematica using the new functionality of Random processes? To take a concrete example, lets consider the ...
8
votes
1answer
144 views

Inconsistent DistributionFitTest results?

In pondering this question, I used Mariana's function to generate the following data. ...
5
votes
2answers
530 views

What is the best distribution for my histogram?

I defined a security bound for a random walk (cube with 15 lengh) and i have this code to obtain a sample of the random times at which the random walk crosses the boundary for the first time: ...
8
votes
1answer
431 views

Uniformly distributed n-dimensional probability vectors

What's the right way to generate a random probability vector $p={p_1,\ldots,p_n} \in {(0,1)}^n$ where $\sum_i p_i=1$, uniformly distributed over the $(n-1)$-dimensional simplex? What I have is ...
6
votes
2answers
89 views

Algorithm in RandomChoice[{w1,w2,…}->{e1,e2,…},n]?

I wonder if someone happens to know the actual algorithm implemented in the particular overload of RandomChoice that handles explicitly presented discrete ...
16
votes
4answers
1k views

Random data generator

Inspired by Quality of random numbers I would like to set up a true random data generator in Mathematica. My idea is to use the static from an open microphone. I recall reading about extracting the ...
8
votes
2answers
485 views

Most efficient way to obtain samples from high-dimensional multivariate distributions?

Is MultinormalDistribution[] efficient and easy to use for high dimensions? I have a variable $n$ representing the dimension of a Monte Carlo integration I do on a ...
6
votes
3answers
452 views

How to randomly erode a 3D distribution of points with Mma 7.0?

Suppose we have a 3D distribution of points, like the spherical ball example below : ...
5
votes
2answers
625 views

Random walk on a sphere [closed]

I'm trying to programme a random walk on a sphere with Mathematica. I found this code while I was searching, but I'm not getting results from it. I waited an entire day, but my pc didn't finish ...
3
votes
3answers
509 views

Generating a random walk with defined step size

By the following I'm trying to generate a list of random coordinates (ex. 4) each within unit distance from previous one, starting from origin. What am I doing wrong? ...
10
votes
2answers
521 views

Creating randomly oriented planes

I would like to create randomly oriented planes. This is how I'm attempting to do that: I create a 2 random unit vectors, $\mathbf{v}_1$, and $\mathbf{v}_2$, in the $x$-$y$ plane I assume that if I ...
9
votes
1answer
632 views

Functional programming and Do loops

I'm writing a Monte Carlo simulation. I'm using a Do loop to create the different simulations, iterating over different ...
4
votes
4answers
554 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 ...
4
votes
1answer
127 views

How do I randomly select 'k' positions in a list and shuffle their respective elements without effecting the other elements?

Imagine I have some list: listA = {"a","b","c","d","e","f","g","h","i","j"}; I'd like to randomly select k positions in the ...
3
votes
1answer
377 views

Randomly selecting elements without repetition

I assigned energy values to each element in the array as per the program of Verbeia. The program looks like this ...
2
votes
3answers
116 views

Performance on Multinomial Deviate is slow

Most of the time in my program is spent on this single line of code: out = RandomVariate[MultinomialDistribution[nt, tmp]]; ...
2
votes
1answer
137 views

Randomizing a lab

I teach a class where students do a weekly lab in Mathematica. They do it in a computer lab, and because there are many of them, and only one of me, I encourage them to help one another. ...
1
vote
2answers
90 views

HoldForm and RandomChoice

I'm trying to get random expressions displaying. For that, I'm starting with addition, multiplication, substraction and division. When trying out this code ...
-1
votes
3answers
201 views

MixtureDistribution in Mathematica 7

Is it possible to use a mixture of several distributions in Mathematica 7.0? Consider for example the following code : ...