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

learn more… | top users | synonyms (1)

2
votes
3answers
54 views

Create a list of random reals

How can I create a list of random pairs $(x,y)$ where $0<y<x<1$ and $x,y \in \mathbb{R}$ ? I can't seem to place that inequality restriction on the random numbers that are generated.
0
votes
0answers
29 views

Generating a Table with a certian Density [duplicate]

How do I create a random table of 0's and 1's with a certain density instead of a probability? For Example: Manipulate[ Table[RandomChoice[{1 - density, density} -> {0, 1}, {10}]], ...
0
votes
1answer
69 views
4
votes
4answers
923 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 ...
6
votes
2answers
590 views

Distribution of 10 points within a unit square

Related to some packing problems, following problem arose: Distribute 10 points within a square of sides 1, so that minimal distance between them is maximized. With the help of random simulation, or ...
0
votes
1answer
47 views

Probability Distribution of a Multivariate Hypergeometric distribution and maximum probability

Hello to all Mathematica Users! I have this question: Consider a box which contains 69 balls. 17 red, 1 white, 29 blue and 22 green balls. There will be picked 7 balls randomly, without putting the ...
3
votes
2answers
178 views

Addition of Matrices [closed]

How can I add the Matrices created by this: SeedRandom@0; Table[RandomInteger[{0, 34}, {2, 2}], {2}, {5}] // MatrixForm $\left( \begin{array}{ccccc} \left( ...
3
votes
3answers
110 views

Creating nested matrix using random integers

How do i create 15x2 matrix with 2x2 random integer elements? My code only returned identical 2x2 elements:
1
vote
0answers
49 views

How to downsample a time series [closed]

How can a discrete-time times series generated from ARProcess be downsampled using Downsample[array,n] ? Thanks.
2
votes
1answer
87 views

Simulating a bounded continuous random walk in $n$-dimensions

You're given three $n$-dimensional real vectors, $\mathbf{x_0}$, $\mathbf{a}$ and $\mathbf{b}$, with $\mathbf{a} \le \mathbf{x_0} \le \mathbf{b}$ (vector inequality means component-wise inequality). ...
4
votes
4answers
553 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 ...
0
votes
1answer
70 views

Plot A Function Of A Stochastic Process

I am trying to do something very simple in Mathematica 9. I want to play around with option pricing and for that I thought it best to use the new stochastic process functionality. So, first of all I ...
1
vote
1answer
68 views

How to generate a random signal consisting of the specified functions

Let's assume that I have some particular signal on the finite time interval which is described by function $f(t)$. It could be, for instance, a rectangular pulse with amplitude $a$ and period T; gaus ...
1
vote
1answer
113 views

Matrix and random, weighted assignment of rows

I asked a question in this category previously but my problem has changed. On one hand, I have a large number of data files as .dat format, and on the other hand, I have a matrix ...
1
vote
4answers
156 views

random split a dataset

I've got a very simple problem, but not so trivial. I need to split a dataset (input and output data) in three part randomly: training set 70%, validation set 20% and is test set 10%. First of all ...
0
votes
2answers
182 views

Generating a random tree of given cardinality, depth, and labeling

For demo, exploration and teaching purposes, I would like to be able (and asking you for help) to generate these special instances of trees: For given: N - number of nodes in the tree D - depth of ...
2
votes
2answers
109 views

Generating $n$ random samples every time

Is it possible to generate $n$ random samples, and always ensure that $n$ samples are generated? eg For $n=5$: ...
1
vote
1answer
44 views

Replicability of RandomVariate within a function?

I have a rather basic question but can't figure out a foolproof answer. In the following code, I build a function which returns the mean difference between successive elements of a vector created from ...
8
votes
2answers
663 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 ...
0
votes
0answers
28 views

Table of values for functions with random variables [duplicate]

I'm trying to get a table of values for functions with random variables. First of all, i have a function like that: ...
0
votes
1answer
54 views

Importing a text file into a matrix format

I am attempting to perform a comparison of pseudorandom number generation with the RAND Corporation's "A Million Random Digits with 100,000 Normal Deviates" for a Computational Physics course. I have ...
1
vote
3answers
135 views

How do I select only those lists whose elements are all above a certain number?

I'm essentially doing coin flips, using RandomReal to populate a bunch of lists, each with 8 elements. I then want to select only those lists for which all elements are greater than a certain number, ...
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 ...
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 ...
3
votes
1answer
54 views

RandomVariate does not evaluate a Hyperbolic Distribution

Any Idea why I can't get a result from this expression: ...
3
votes
5answers
155 views

Randomly selecting and reinserting a subset of elements in a list

This question is similar to my other question: How do I randomly select 'k' positions in a list and shuffle their respective elements without effecting the other elements? Imagine first a ...
0
votes
1answer
73 views

How to efficiently distinguish the rewired edges in WattsStrogatzGraphDistribution?

The WattsStrogatzGraphDistribution function is a way to construct random graphs based on Watts and Strogatz small world model. The ...
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 ...
1
vote
1answer
76 views

Generating a random sample of elements from a list that includes a subset of the list

Imagine I have a list: tList = {item1,item2,item3,item4,item5,item6,...}, and I'd like to take a random sample of numItems ...
1
vote
0answers
74 views

How do I keep a random value associated with a locator point as points are added?

I have a Manipulate to which I am adding and removing Locator points (one of which is different from the others, though that is ...
5
votes
3answers
328 views

Fast code to generate large random graph with fixed degree sequence

I'm trying to create a function so to generate large random graph with a fixed degree sequence $\{v_1,v_2,\dots,v_N\}$, where $N$ is the number of vertices in the graph. The Mathematica function that ...
3
votes
1answer
177 views

Put random points into a specific 2D subregion

I want to cover a particular subregion of the x-y plane with a random distribution. As this particular region is not a circle I encounter some problems declaring the permitted zone where to put ...
1
vote
1answer
113 views

How to replace a list with the result list after each iteration [closed]

I have some initial values such as L1 list: L1={10,20,30,40,50}; I want to use the L1 ...
0
votes
1answer
79 views

Index of iteration inside NestList [duplicate]

I have a list of RandomReal: delta = RandomReal[{-0.01, 0.01}, 1000] I want to add each element of the list to the ...
6
votes
1answer
189 views

Generating a (random) 2-dimensional cellular network

I want to generate a network of random cells like the following picture: The general idea is to generate some random points (x,y) as coordinate of a vertex and then randomly choose some of these ...
1
vote
3answers
171 views

How to update a list in a function in each iteration

There is a list with numbers 1 to 8 ( p1 ) and another list (j) which contains 4 numbers which shows different 4 positions of ...
1
vote
0answers
93 views

Monte Carlo integration with random numbers generated from a Gaussian distribution

I want to do numerical integration of some functions using the Monte Carlo method. The default setting for the Monte Carlo method is to use a uniform distribution as far as I know. How can I change ...
1
vote
3answers
173 views

How to replace identical positions in two different lists

Assume that I have two lists like : list1={1,2,3,4,5}; list2={a,b,c,d,e}; I want to replace some elements from list1 into ...
14
votes
5answers
779 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. ...
0
votes
1answer
46 views

How to put some values from a list into a function in a Do loop

I want to program a code in MATHEMATICA in order to calculate some values in different iteration. For example, assume this list: list={1,2,3,4,5} Now assume that ...
1
vote
2answers
76 views

Avoid making repeated Random Integer in different iterations

Assume following code : Do[ i1 = RandomInteger[{1, 5}]; i2 = RandomInteger[{1, 5}]; While[i1 == i2, i2 = RandomInteger[{1, 5}]] , {k, 1, 4}];` This ...
14
votes
1answer
302 views

Making Monte Carlo simulation with ParallelTable

I would like to to MonteCarlo simulations of various regressions - basically, doing OLS under various conditions to test approaches. On my macpro 2x 2.8 GHz quad core Xeon, 32 Gb RAM DDR2 @ 667 Mhz, ...
0
votes
2answers
79 views

Multiplying a list and randomly re-assigning that list to a series of numbers

I'm trying to write a script that matches a particular element to a coordinate. Let's say there are 24 coordinates; and that fractionally a:b:c:d:e is 18%:18%:18%:18%:27%. Instead of matching 4 of a, ...
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]]; ...
8
votes
1answer
142 views

Inconsistent DistributionFitTest results?

In pondering this question, I used Mariana's function to generate the following data. ...
5
votes
2answers
528 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: ...
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
2answers
168 views

Color of first and last point in a graphic

I'm trying to make a graphic of a random walk in 1D, but i want that the first and the last point have a color (in this case the first one red and the last blue), but i dont know what i'm doing ...
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 ...
1
vote
0answers
74 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 ...