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

learn more… | top users | synonyms (1)

5
votes
0answers
39 views

RandomInteger: speed with long lists

I noticed an interesting effect with RandomInteger when looking at the time to create 10^8 random integers. The following code lines all take about 0.5 seconds on a ...
0
votes
2answers
61 views

Random 3D cylinders plot [duplicate]

I have seen this trivial example for circles ...
4
votes
2answers
202 views

Calculate $\pi$ using Monte Carlo methods

I know that we can have an estimate of $\pi$ using Monte Carlo methods. I know that we make a huge loop and each time we take randomly two numbers in the range [0,1] and calculate the number of ...
2
votes
0answers
43 views

The correct assignment of probability distribution to generate random variables

I'm asking you for a help to solve a difficult (for myself) task. Now I will tell you what and why I'm trying to implement. The task is to simulate the passage of elementary particles through a ...
1
vote
0answers
41 views

Generating random Kraus operators

I am trying to generate (randomly) set of square matrices $\{K_m\}$ with the properties that $$\sum_{i=1}K_i^{\dagger}.K_i=I_n,$$ where $I_n$ is the identity matrix of order $n$. So, the input should ...
0
votes
1answer
50 views

Simulating a Boolean model in a uniform square

I am looking to simulate a Boolean model with specified Poisson point process. ...
0
votes
1answer
63 views

How to generate samples from an arbitrary continuous pdf?

If I define an arbitrary pdf p[x_] for a arbitrary-dimensional continuous variable x, how can I use Mathematica to create a function that will return a set of n random samples of x with distribution ...
-1
votes
1answer
125 views

Periodic boundary conditions for two walkers

For some reason I'm getting infinite loops most of the time i run this. Perhaps the periodic boundary conditions are wrong. Seems like the probability of the two positions to be the same is extremely ...
-1
votes
1answer
80 views

Draw independent samples from conditional distribution at a fast rate

I would like to draw samples from the following conditional distribution of the following (don't ask why): ...
1
vote
1answer
68 views
0
votes
0answers
3 views

Complexity of a randomly-traveled N*M grid [migrated]

I made an algorithm that compute a random-path across a N*M grid using backtracking. It start at [N / 2][0] and shall finish at [N / 2][M - 1]. Each iteration he choose a random direction (Left, ...
4
votes
2answers
563 views

Manipulate 2D random walk

Consider the first $10000$ digits of $\sqrt{2}$ and present them as a “random walk” by converting them in base 4 representing 4 directions. Following code produces this random walk ...
3
votes
3answers
89 views

How to change random values in manipulate?

I made a Manipulate box that is working very well, using lots of random numbers. I would like to add a button to "reset" (i.e. to change, randomize, or reselect) all the random parameters. Here's ...
1
vote
2answers
85 views

Animated discrete plot for a generalised random walk

I have a number of possible outcomes $R=\{r_i\}$, with $r_i\in\mathbb{Z}$ and corresponding probabilities of occurrence $P=\{p_i \}$, with $p_i \in [0,1]$ and $\sum_i p_i=1$. I am wondering whether ...
3
votes
5answers
177 views

How to define a set of two random orthogonal unit vectors?

I need to define a random set of two orthogonal unit vectors. The code below doesn't give proper unit and orthogonal vectors : ...
1
vote
1answer
74 views

How to define a stochastic electromagnetic field? [closed]

I would like to show the effect of a stochastic electromagnetic field on a relativistic charged particle, using a manipulate box. The field should be randomly varying in time and in space, and be ...
0
votes
0answers
69 views

Maximum Likelihood Estimation of Gamma-distribution Scale parameter

I have the following tasks: Generate random sample with given parameters shape = 2, scale = 0.001 and shape = 2, scale = 1/1200 for the right censored sample; Using Maximum Likelihood Method ...
3
votes
0answers
28 views

Missing Completely at Random MCAR

Many other stats packages have tests for MCAR but Mathematica doesn't seem to. Have a I missed something? If not what would a simple implementation in MMA look like. (disclaimer I'm new to MCAR ...
1
vote
2answers
124 views

Speed up RandomVariate on a custom probability distribution

I have created a custom probability distribution: ...
1
vote
1answer
144 views

Bounded random walk

I have a random walk algorithm that I want to implement, but I am getting a recursion depth issue. I am making a list of points that Z particles can be in over the ...
5
votes
2answers
88 views

Convergence data for Monte Carlo NIntegrate

I am using NIntegrate with Method -> "MonteCarlo" to evaluate a high dimensional integral. Is there a way I can obtain a list ...
10
votes
6answers
591 views

How do I randomly divide individuals into groups?

I would like to assign 'x' individuals to 'y' groups, randomly. For example, I would like to divide 50 individuals into 100 groups randomly. Of course, with more groups than individuals many of the ...
1
vote
1answer
90 views

Drawing a 3D Poisson Point Process with intensity $\lambda$

Can anyone suggest me a way of drawing a 3-dimensional Poisson Point Process (PPP) with intensity $\lambda$ in Mathematica. The points are located only in a half sphere. The 3-dimensional ball of ...
0
votes
2answers
60 views

generate “dynamic” random variables?

I have the following problem: I generated two random numbers ...
6
votes
0answers
77 views

RandomPoint works with a 2D ImplicitRegion but fails for any higher dimension

This is inspired by this answer which features code that I cannot get to work at all, and I tried to figure out why. It boils down to using the function ...
7
votes
1answer
148 views

Why is Random faster than RandomReal?

As of version 6, Random[] was superseded by RandomReal[ ] etc, but both still work perfectly well. Playing with some timing ...
7
votes
4answers
230 views

How to generate two group of $n$ random numbers in $U(0,1)$ such that sum of these two groups equal? [closed]

I want to have two groups of $n$ random numbers $u_i$ and $v_i$ in $U(0,1)$, such that $\sum u_i = \sum v_i$ What I tried is: I can firstly get $u_i$ by ...
7
votes
1answer
78 views

RandomPoint fails with a large enough number of points

Bug introduced in 10.2.0 and fixed in 10.3.1. RandomPoint is new in 10.2.0. I have defined a simple ellipsoidal parametric region: ...
3
votes
3answers
87 views

Random bipartite graphs?

RandomGraph[{n,m}] generates a random graph with $n$ vertices and $m$ edges. I want to generate a random bipartite graph, like ...
3
votes
3answers
151 views

Smooth initial data

I need something that produce pseudorandom smooth initial data for modelling phase separation equations (Cahn-Hilliard and simular). Generator code for now: ...
1
vote
1answer
49 views

Generate a simulated covariance matrix

I am working on a problem where one of the input variables is the level of covariance between the entries in a particular matrix. To simulate this problem in Mathematica, I will need to feed my code ...
1
vote
2answers
144 views

Handling of Temporal Data [closed]

I use a random function of a process which yields a Temporal Data object, I need but do not know how to recuperate the numerical values of the process in a Table from the Temporal Data.
6
votes
3answers
260 views

How can I create a random symmetric matrix in this way?

The most straight forward way for me to think about is like this: ...
4
votes
2answers
140 views

Confining/Periodic boundary conditions implementation for 2D Random Walker

I am new to Mathematica, and am having trouble implementing confining boundary conditions for a random walk simulation confining the walker to a pre-defined region (periodic boundary conditions would ...
1
vote
0answers
82 views

Manipulate a random walk [closed]

For a college project I am manipulating a random walk. I managed to make a walk but in the manipulation every time a step is added the manipulation shows an entirely different walk. I understand why ...
4
votes
6answers
903 views

Randomly Multiply OR Divide by a Random Number?

I want that Mathematica decides randomly if a given variable, gets multiplied or divided by a random number in a given range. The "naive" idea to just use ...
1
vote
1answer
74 views

Random phases at each run in a wave superposition [closed]

I need to define a function which generates a random real number between 0 and $2\pi$, as a random phase constant for a wave superposition. The output should be different each time I re-run the code, ...
3
votes
1answer
137 views

Random Variate generating strange results when using ProbabilityDistribution

I have created a probability distribution that follows a general normal distribution, given by: $$ \frac{b *e^{-\left(\frac{\sqrt{(x-u )^2}}{a }\right)^{b }}}{2 a \Gamma \left(\frac{1}{b }\right)} ...
1
vote
1answer
103 views

How to use a random number generator as an independent variable in an existing model?

I am relatively new to Mathematica and I need some help regarding how to create a random number generator to be used as an independent variable for a model my group has been working on. Following is ...
5
votes
1answer
125 views

How to make my fuction return a step count

I am new to mathematica, and I have this 3d random walker program which runs with a fixed (given) amount of steps. What I want it to do is to run forever but stop when two walkers collide (aka have ...
4
votes
1answer
204 views

How to generate random natural numbers in $[1, \infty)$? [closed]

Functions like RandomInteger draw random variates from a finite range. Can one also obtain random natural numbers in case the range extends from 1 to infinity? If ...
5
votes
2answers
222 views

How to generate a random pulsar graph between two points?

I am going crazy trying to create this. I am trying to create a pulsar graph that starts and ends on two points that have the same y smoothly along the x axis. The pulsar should have random valleys ...
4
votes
1answer
129 views

Find random $n$ combinations of values with a given sum

This problem is described in the related StackOverflow question: Find all combinations of coins when given some dollar value. I would like generate a list of $n$ combinations of values that sum up to ...
5
votes
1answer
65 views

How to solve an equation system whose equations are based on Mod[x,y]

I'm trying to find the parameters of a specific linear congruential generator (pseudo random number generator) based on a list of the first five numbers generated by it. The list is this one: ...
1
vote
1answer
90 views

Generate $n$ randomly oriented non-intersecting cylinders with fixed radius and length

This post is in reference to the previous question here. How could I adapt the solution given to have the following constraints: fixed radius, fixed length, number of cylinders, and within a ...
6
votes
1answer
107 views

ParallelTable and Random

Each time I execute the following code it generates the same cylinders with the same format. ...
1
vote
1answer
69 views

Why doesn't RandomChoice work here? [closed]

I was using RandomChoice to run a simulation to test the probability that picking 4 marbles out of a bag containing 3 red and 7 blue marbles you get 2 red and 2 ...
5
votes
2answers
146 views

Extending a list

I have a range of n integers (always starting at 1) which are 1 apart, f.e. Range[10], Range[17] or ...
3
votes
2answers
239 views

generating randomly oriented non-intersecting cylinders

I could not find anything relevant with "googling" (only this) I can create a set of randomly oriented cylinders (code found here) ...