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

learn more… | top users | synonyms (1)

2
votes
2answers
218 views

Fast randomization of a graph, while keeping the graph connected

I'm looking for a very efficient method for randomizing graph of a given size (N nodes, L links), but keeping them connected. Assume you have the adjacency matrix A of a given connected graph. You ...
2
votes
1answer
46 views

How to randomly select and open a notebook using CDFPlayer

I have a lesson notebook for a class I am teaching. I'd like to separate the lesson content and the practice problems. Students are using the CDFPlayer program, not Mathematica. I created a button ...
93
votes
7answers
16k views

How to generate a random snowflake

'Tis the season... And it's about time I posed my first question on Mathematica Stack Exchange. So, here's an holiday quest for you Graphics (and P-Chem?) gurus. What is your best code for generating ...
15
votes
4answers
1k 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: ...
9
votes
4answers
401 views

Why is Poisson Random Deviate Generation so slow?

I am generating Poisson deviates for some numerical work. Mathematica 9.0.1 is very slow in generating these random numbers, as can be seen below. ...
2
votes
2answers
185 views

How to restore default seed generation in SeedRandom[] when specifying method?

I want to generate low-discrepancy sequences and for that purpose I use SeedRandom[], like: ...
-1
votes
1answer
60 views

map rational number [duplicate]

I am trying to map this function ((-1)^(1/Denominator[#]))^Numerator[#]==(-1)^#& to a fairly big list of random rational numbers I am trying to get this to ...
6
votes
1answer
168 views

Random filling of L-length line with l-length segments

I have discrete L-length line filled randomly with 2-length segments so its cover line with gaps 0 or 1. So we can describe cover configuration as sequence of gaps such as {0,0,1,0,1}. How I can ...
1
vote
1answer
105 views

Random number generation from a given distribution [duplicate]

Is there any way to obtain random numbers from a user defined continuous distribution in Mathematica? Thank you very much
1
vote
3answers
155 views

Number theory: Problem involving rational numbers

Use RandomRat to test whether ((-1)^(1/Denominator[q]))^Numerator[q] is identical with ...
9
votes
1answer
538 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 ...
7
votes
1answer
163 views

RandomVariate does not fill range of PDF of distribution

I've declared my own probability distribution as follows dist[a_, b_] := ProbabilityDistribution[Cos[(b x)/2]^2 Sinc[a x]^2, {x, -400, 400}]; When I try to ...
8
votes
2answers
867 views

How could I generate words starting with P,h,D?

A friend of mine is a PhD candidate and posted a picture on Facebook with funny words starting with 'p', 'h' and 'd' like "Please hire. Desperate" or "Permanent head Damage". I thought I could try and ...
8
votes
3answers
426 views

Create sine function with random increase in phase

I am trying to simulate a signal that randomly increases its phase, so far I have tried two thing but neither worked. I usually use matlab but I want to learn some Mathematica so I thought I would try ...
17
votes
3answers
833 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 ...
24
votes
4answers
495 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 ...
15
votes
8answers
396 views

Is it possible to use RandomChoice to choose without other choices being evaluated?

I'm trying to do this: i1 = 1; i2 = 1; RandomChoice[{ (i1 = i1 + 1), (i1 = i1 - 1), (i2 = i1 + 1), (i2 = i2 - 1)}] In order to chose randomly which ...
1
vote
2answers
97 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 ...
3
votes
1answer
323 views

How do I get a list of unique random integers? Avoiding numbers being drawn twice [duplicate]

I am trying to get a set of random integers for which I used the function RandomInteger[{1, 50}, 5]. That way, however, there is the chance to get doubles such as ...
2
votes
2answers
672 views

How to generate a random matrix with specific parameters?

I want to use Mathematica to generate a random matrix with given dimensions, entries coming from a finite set, and with a determinant also coming from a finite set. (It's very important that the ...
13
votes
1answer
264 views

Randomness test suites that can be invoked from Mathematica

There are several test suites referenced at csrc.nist.gov designed to test a (pseudo-)random byte sequence for randomness, and discover possible skews, correlations, patterns, or other hidden ...
-5
votes
1answer
274 views

random number visualization without generator (Spectral Test)

Does anyone have codes for using only numbers to make this kind of random-number visualization and not requiring a number generator? ...
0
votes
1answer
100 views

Random variation inside NMaximize

I am using NMaximize as following code. ...
1
vote
2answers
229 views

Problem in simulating discrete time stochastic

I have been playing with some stochastic questions and specially the problem here.It seems no matter for the first time in bet, gambler is going to lose the first bet.Am I right?How can we correct the ...
5
votes
2answers
325 views

Adding noise to nonlinear control system using NDSolve

I have a nonlinear control system ...
3
votes
1answer
268 views

Boundary condition for stochastic differential equation

I have a simple stochastic differential equation (SDE) with white noise: ...
4
votes
1answer
216 views

How can I randomize order of elements in a list?

Is there a straightforward way to go from an ordered list like: ord = {a, b, c, d, e, f, g, h} to a disordered list like: ...
8
votes
1answer
207 views

Have the Random functions changed?

I re-ran a program I wrote for Mathematica v8, now on v9, and it appears to generate different RandomInteger numbers, even though I use the same ...
0
votes
2answers
211 views

Random variates in Recurrence Function

I'm completely new to Mathematica and can't seem to find an answer elsewhere so hopefully I can get some help here. I'm trying to plot a recurrence relation, where a random variate is generated at ...
3
votes
2answers
184 views

Bounds on random number

I have a Markov Chain Monte Carlo code that uses a chi squared function to fit some data. I am running into an issue now with getting unrealistic values for some of the free parameters in the code. ...
3
votes
1answer
745 views

White noise $\eta(t)$

How to make a random function $\eta(t)$ to insert in a differential equation for NDSolve? Edit: example: to solve equations like $\frac{dx}{dt}=\eta(t)$
1
vote
1answer
197 views

Safe values of $\mu$ and $\sigma$ when randomly sampling from a Log-Normal Distribution?

I believe I'm obtaining overflow errors when randomly sampling from a log-normal distribution with the command: RandomVariate[LogNormalDistribution[μ, σ], 1] ...
2
votes
0answers
578 views

Calculate variance of random walk?

How can I symbolically calculate the variance of the following random walk in Mathematica? Given several discrete random variables such that $p(Z_i=1-2k)=p$, where $k$ is a small real number, and ...
15
votes
1answer
638 views

Mathematica giving infinity as a random number!

I am trying to generate several random numbers from normal distribution using Mathematica. The following is the relevant code: ...
2
votes
2answers
288 views

Help with 1-dimensional random walk [closed]

I would like to simulate the evolution of a bankroll of a 2 player game where you have the probability of winning p. If a player wins, the bankroll grows by 1 unit minus a fee that each player pays, ...
14
votes
3answers
464 views

How to Import random elements of huge data files

I am calculating huge data files with an external program. I would like then to import the data into Mathematica for analysis. The files are 2 columns and up to many millions of rows. So for ...
13
votes
1answer
508 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 ...
2
votes
1answer
123 views

How to label vertices in a grid with random integers?

I would like to assign each vertex a random number with the minimum bound equal to the smallest vertex and the maximum equal to the value of the largest without repeats. For example, in a 20x20 grid, ...
2
votes
2answers
179 views

Illustrating half life

I'm teaching some lessons on negative exponents and one application listed was half life since the rate of decay can be written as 2^-1 every __ years. I found this nice animation on the net. ...
12
votes
3answers
2k views

Create triangular mesh from random list of points

I have a list of points. I would like to take these points and create a mesh of triangles from them, making sure triangles don't overlap. So here's a list of points: ...
3
votes
2answers
310 views

Colors associated to parts of a 3D distribution of points

Suppose we have a long list of random points (cartesian coordinates) in 3D space. coords := ...; Until now, I was associating colors in a radial way, from the ...
9
votes
5answers
541 views

Randomly assigning color to Graphics3D objects?

I have a set of Graphics3D primitives (here, spheres) which I would like to assign either: (1) One of a subset of colors, e.g. {Green, Red} (2) A random color over some RGB interval Writing ...
3
votes
1answer
411 views

Radial Random Walk

I'm trying to generate a spherical distribution of radial random walk points in 3D space. The following code works, but the random walk lines aren't radial. Why ? Where is my mistake ? ...
1
vote
1answer
348 views

Gauss Markov Process

I am trying to model a 1st order Gauss Markov Process (gyroscope drift). I know the Allan Variance characteristics of the process (bias instability, random walk characteristics). I know the model ...
-1
votes
3answers
207 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 : ...
11
votes
3answers
589 views

Efficient implementation of a linear complexity measure of binary sequences

For a implementation of testing the quality of random number generators I implemented the NIST test suite in Mathematica based on the nice workbook by Ilja Gerhardt. However I took up the challenge ...
2
votes
1answer
290 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 ...
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. ...
6
votes
3answers
456 views

A deterministic function to generate a random number

Using Mathematica, I need to define a function of one integer variable that generates the same real number in the range 0 to 1, if it is called with the same argument, but gives a different real ...
20
votes
2answers
765 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 ...