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

learn more… | top users | synonyms (1)

1
vote
0answers
42 views

Randomly generate a list of arbitrary length from a finite set [on hold]

I have a finite set of elements (5 to be exact). Suppose the first element has probability $\frac{1}{2}$ of being selected, while each of the others has probability $\frac{1}{8}$ of being selected. ...
3
votes
1answer
144 views

Failed to create a special random-disturbed initial condition for partial differential equation

I try to use BSplineFunction to creat a initial condition for NDSolve which has periodic boundary condition, that is realized by ...
15
votes
3answers
1k views

Can Mathematica's random number generation be improved?

Performance on Random Number generation is intolerable. Whenever you need many deviates from the same distribution but with different parameters it takes forever. Here is a thread on Poisson ...
32
votes
7answers
3k 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 ...
0
votes
0answers
19 views

Creating points that are remoted from one another beyond a certain threshold. Quasirandom sequance? [duplicate]

I am looking for an approach to create a set of pseudorandom pairs of numbers subjected to one condition. They must be not closer to one another than a certain limiting parameter. One approach might ...
5
votes
1answer
64 views

RandomPoint in geographic region from Polygon[region_]?

How do you generate a RandomPoint in a geographic region? ...
16
votes
2answers
264 views

Implementing the PCG random number generator

PCG ("permuted congruential generator") is a recently-introduced random number generator. PCG is a family of simple fast space-efficient statistically good algorithms for random number generation. ...
8
votes
3answers
299 views

When does a list contain only ones?

I am starting with a list of length n that contains all -1's. For instance, when n = 6 the list is {-1, -1, -1, -1, -1, -1}. I ...
28
votes
4answers
642 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 ...
7
votes
0answers
58 views

Restarting random number generators where you left off

I have code that uses both RandomReal and RandomInteger a number of times to produces a sequence of $n$ data sets. After ...
14
votes
1answer
139 views

Why does't SeedRandom work here?

From the docs on SeedRandom, SeedRandom[] resets the generator, using as a seed the time of day and certain attributes of ...
15
votes
1answer
388 views

RandomVariate returns values outside the support of a PDF

Bug introduced in 8.0.1 and fixed in 10.2.0 Let $X$ be a random variable with pdf: dist = ProbabilityDistribution[1/(Abs[x]*Log[Abs[x]]^2), {x, -E^-2, E^-2}] ...
0
votes
1answer
34 views

Variable Definitions and Random Numbers [closed]

I have currently created the following matrix: m={{RandomReal[{0,1}],RandomReal[{0,1}]},{RandomReal[{0,1}],RandomReal[{0,1}]}} In other words, a $2 \times 2$ ...
3
votes
1answer
373 views

Boundary condition for stochastic differential equation

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

Optimizing Monte Carlo simulation of a Pred-Prey model

My assignment and code As part of an assignment for one of my classes, I'm trying to run a "massive" Monte Carlo simulation in Parallel on the follow model: ...
1
vote
1answer
47 views

How to repeatly use random number generator in optimization problem

I am looking to run the optimization problem. I already finish my optimization code as below. ...
12
votes
4answers
1k 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 ...
12
votes
2answers
247 views

Sampling a phase space uniformly for a given energy?

The energy for a 1D harmonic oscillator can be written: $$ E = \frac{1}{2 m} p^2 + \frac{m \omega^2}{2} x^2 $$ where x is position and p is the momentum. I would like to sample phase space $(x,p)$ ...
0
votes
0answers
35 views

Simulating from CopulaDistribution

I am currently using CopulaDistribution and have been generating RandomVariates from this distribution. Say my code looks sort of like this (this is much simpler) ...
5
votes
3answers
103 views

ImplicitRegion gives arbitrary boundaries

This question uses Mathematica 10.2.0.0. equation1 is the major unbounded region I would like to generate: ...
20
votes
2answers
888 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 ...
30
votes
1answer
2k views

RandomVariate from 2-dimensional probability distribution

A probability distribution can be created in Mathematica (I am using 8.0.1) with e.g. ...
4
votes
1answer
70 views
2
votes
3answers
516 views

For loop in Length computation code

Here is a code I wrote that is supposed to give the length of list after some splitting and regrouping. But it is inefficient. Is there a way to rewrite in more professional and efficient way? I guess ...
5
votes
2answers
130 views

How to find an estimated root efficiently with binary stochastic estimation of the function?

I am trying to construct certain nice geometric patterns, and one particular feature I'm trying to optimize is the balance of black and white corresponding to point being inside, or outside a ...
8
votes
2answers
278 views
13
votes
1answer
718 views

Uniformly distributed n-dimensional probability vectors over a simplex

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 ...
3
votes
2answers
280 views

How do I generate n random numbers with an extra condition [duplicate]

I need to generate n random numbers that would sum into a. And I can't find an elegant solution here: ...
27
votes
3answers
422 views

Assign a randomly generated list to variable

Bug introduced in 10.0.0 and fixed in 10.0.2 I don't know if this is a silly question, but it really baffles me. So please help me understand this behavior. ...
28
votes
8answers
1k 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: ...
0
votes
2answers
157 views

Random non-overlapping disks in a square

I've found a nice code snippet by @belisarius from this question, that I'll reproduce here for reference: ...
2
votes
1answer
66 views

How do I define a random variable involving Part?

I need to define a random variable that involves Part, but when I try, for example ...
12
votes
1answer
488 views

What function generates random numbers in a compiled function?

I am writing a simulation for 2D random walk. I wrote several version of code, and found that the speed is like this (fastest to slowest): C++, Mathematica compiled procedural code, Mathematica ...
0
votes
0answers
68 views

Retrieving forthcoming step size from NDSolve

I'm solving a system of ODEs with a random component, which changes at each calculation step and depends on the step size. So I'm trying to realize something like this: (1) size of the forthcoming ...
6
votes
1answer
92 views

Slow-down encountered for RandomChoice in large lists

I was wondering if anyone could help me to speed up this code snippet which creates simple (sparse) networks by preferential attachment. The algorithm adds a vertex and an edge each time interval. ...
2
votes
2answers
83 views

Better to use loop or function when populated list?

In the past I have pretty much stuck to expression building when using Mathematica, but recently I have been writing a procedure to populate an array, which I guess are called "lists" in Mathematica. ...
14
votes
5answers
447 views

How can I generate and randomly assign color to annular sectors?

How can I generate such an image and fill every annular sector with a random colour?
10
votes
5answers
737 views

Randomly assigning color to Graphics3D objects?

I have a set of Graphics3D primitives (here, spheres) which I would like to assign either: One of a subset of colors, e.g. {Green, Red} A random color over some RGB interval Writing something ...
17
votes
4answers
2k 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 \leq 1$ in the first octant: ...
1
vote
3answers
104 views

Partitioning List Into Sublists of Length 2 With The Pairing Being Random

I've done a bit of Googling with hopes of finding an answer, but to no avail. I'm looking for a way that I can have Mathematica take the elements of a list, say ...
3
votes
1answer
275 views

Plotting random circles in a square

How can we draw 20 circles which have random radius in a specified range, with random positions. All centers must be in a square with side=10 (for example centimeter): every overlapping between any ...
5
votes
1answer
547 views

Generating random symmetric matrix

Suppose first that I want to generate a matrix whose elements are independent and identically distributed (i.i.d.) with distribution dist. This is easy: ...
8
votes
3answers
540 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 ...
24
votes
3answers
861 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 ...
16
votes
1answer
488 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 ...