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

learn more… | top users | synonyms (1)

7
votes
1answer
121 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 ...
6
votes
5answers
161 views

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

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 ...
6
votes
1answer
64 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: ...
0
votes
1answer
26 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 ...
2
votes
3answers
70 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
38 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
125 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.
4
votes
2answers
115 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
1answer
199 views

What is the fastest way to obtain the eigenvalues of a Wishart matrix?

I would like a fast method of creating a sample of random numbers which corresponds to the eigenvalues of a Wishart matrix: For M>N the eigenvalues \lambda_i are given by the jpd Where $K_N$ is ...
1
vote
0answers
75 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 ...
2
votes
1answer
109 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)} ...
0
votes
0answers
47 views

Random phases at each run in a wave superposition

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, ...
1
vote
2answers
237 views

Finding uniformly distributed random points on an ellipsoid

I am trying to generate a poincare map for a system whose reduced energy manifold looks like the following surface. (x/a)^2 +(y/b)^2 +(z/c)^2=1 I want to find a ...
1
vote
1answer
98 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
119 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 ...
12
votes
6answers
846 views

Generating Random Real numbers with certain numbers not included

I'm writing a program that i need 1000 real number between -3 and 6. the code that I used for generating and saving them was l = RandomReal[{-3, 6}, 1000] But I ...
5
votes
3answers
937 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: ...
1
vote
3answers
281 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: ...
4
votes
1answer
197 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
1answer
64 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: ...
0
votes
0answers
108 views

Random generation of three-non-collinear and four-non-coplanar points in 3D space

Please, take a look to this code. How it can be improved so that the time execution becomes smaller? ...
5
votes
2answers
712 views

Simple Monte Carlo simulation

I want to find the Monte Carlo simulation of the integral $$\int_0^1 \sqrt{1-x^2}\mathrm dx$$ The Cesàro mean is $$I_n=\frac1n\sum_{k=1}^{n} f(U_k) $$ I want to plot the scatter plot ...
1
vote
1answer
64 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 ...
14
votes
4answers
2k views

Random letters: What is the chance that real words are generated?

Suppose that we are just typing random letters with our keyboards and we include space bar. We don't distinguish between capital and lowercase letters. If we do this for a long time, how many of the ...
3
votes
2answers
205 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) ...
6
votes
1answer
95 views

ParallelTable and Random

Each time I execute the following code it generates the same cylinders with the same format. ...
1
vote
1answer
63 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
143 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 ...
4
votes
4answers
443 views

Creating a fast random array generator

I want to create N x N array of random numbers. (N is an integer). The constraints are, each element should be between 0 to l(integer) ( here 0<= l <= N) and the sum of elements in each row ...
8
votes
1answer
115 views

RandomPoint in geographic region from Polygon[region_]?

How do you generate a RandomPoint in a geographic region? ...
1
vote
3answers
112 views

how to find circles that intersect a square

I use the following (based on ideas and functions I got as ansers in [1], [2] by, repsectively, @ybeltukov and @J.M.) in order to find random circles with centers inside a unit square that intersect ...
4
votes
2answers
463 views

Boundary condition for stochastic differential equation

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

Hermitian Matrix

From Derbyshire's Prime Obsession, I would like to get the Mathematica code to generate a Hermitian matrix for evaluation and display. $ 256 \times 256 $ would be nice. Random Normal distribution, ...
3
votes
1answer
61 views

StringReverse question

I was thinking about how to make this with the StringReverse, but I failed: I have a sequence of (for example) "FDSRTYNHFNKHLIUHG", I wish to reverse, but randomly long sequence reversed from a ...
5
votes
5answers
418 views

Random character change in a random place

I would like to ask for help in a Random Replace of character. For example: ORANGE and change 1 character randomly (random place and random character from ORANGE) in it into any character of ORANGE, ...
3
votes
1answer
73 views

Random Variable in Recurrence Function

Following the previously published question, I'm looking for the solution of RecurrenceTable with explicit random variable. For example, something like ...
9
votes
2answers
231 views

What will happen, if I don't specify random seed by SeedRandom function?

Suppose I want to run several times of the same code containing RandomReal function, but I don't initialise the random seed. What will happen? I tried, but each ...
6
votes
3answers
353 views

find the maximum number of not intersecting circles inside an ellipse

$Version "10.3.0 for Linux x86 (64-bit) (October 9, 2015)" (Sequel to 98724 and 99345) (I use codes originally created by Andy Ross, ybeltukov and J.M.). I ...
3
votes
2answers
86 views

Storing and taking average of random number generated plots [closed]

I am working on a code which generates a number of random numbers which I have to use in a set of matrices. This set is then multiplied with some other matrix set in a particular order. And finally I ...
0
votes
1answer
108 views

How to draw cylinders inside a cylinder

It can be considered as a sequel to 98724 I adopt the code of ybeltukov (thanks again) and I slightly modify it. ...
6
votes
5answers
2k 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 ...
5
votes
3answers
167 views

Generating correlated random variables with normal distribution

This site and this site provide some background as to what I am trying to achieve, but with some variations in what is required. First I want three random variables with a normal distribution, ...
5
votes
2answers
234 views

Generate random non-intersecting lines inside a square

EDIT I have the following code which generates (pseudo-) randomly oriented and distributed but not intersecting lines. In fact, the code is from the reply I got here: ...
4
votes
1answer
171 views

Random Partitions

I want to write a function RandomPartition to partition a vector of length n into p partitions of varying (random) lengths. For example with ...
32
votes
5answers
739 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 ...
25
votes
5answers
2k views

Generate two random numbers with constraints

I want to generate two random numbers, $p$ and $q$, between $0.5$ and $1$. They are connected by the constraint $1/(2q) > p$. How do I generate $p$ and $q$?
1
vote
0answers
45 views

Sampling from an one-dimensional Wishart [closed]

I searched for a similar question but could not find one. My problem is sampling from an one-dimensional Wishart distribution. The Mathematica specification is ...
1
vote
1answer
110 views

How to simulate Multifractional Brownian Motion?

The maximum I would ask, is hints, how to model MFBMotion. Link to paper Firstly, i wanted to simulate in MATLAB that code: ...