Questions on the algorithms for and uses of (pseudo)random number generators in scientific computing.

learn more… | top users | synonyms

5
votes
3answers
170 views

Constructing random divergence-free velocity fields

I am trying to simulate decaying homogeneous isotropic turbulence. As initial condition I want a divergence-free vector-field, i.e, $\mathrm{div} U = 0$. How do I initialize random velocity field in ...
0
votes
1answer
60 views

Pseudo random numbers

I am learning how to use pseudo random number generators but the instructor just told us how they work without explaining why they work. For example, can one prove that the numbers generated by LCG ...
9
votes
3answers
230 views

Parallel Mersenne Twister for Monte Carlo

Recently, I came across a comment claiming that almost all researchers doing Monte Carlo methods are doing it wrong. It went on to elaborate that merely choosing different seeds for different ...
2
votes
1answer
98 views

Difference between true & pseudo random numbers

I recently heard that in Linux, /dev/random and /dev/urandom are pseudo random number generators but not true random number ...
1
vote
1answer
46 views

PETCs - How should one initialize PetscRandom?

The documentation of PETSc shows an example of usage: ...
0
votes
1answer
36 views

PETSc - how computing a random number between 0 and 1?

In PETSc, I need to generate a random number between 1 and 0. With the include cstdlib, the classical trick is: ...
0
votes
0answers
50 views

Generating Random Numbers in Fortran for Metropolis method

I am having a really hard time getting any kind of reliable / consistent result from my Metropolis code. I have torn it apart and am now examining just the randomness in my random number generator. I ...
1
vote
2answers
48 views

Maintain Uniform Distribution across Subranges

Note: this is a continuation of Generate Random Number outside Bounds. I have a function (thanks to the previous question) with the following prototype which returns an integer in the range $[0,b]$, $...
4
votes
2answers
114 views

Generate Random Number outside Bounds:

Say I have a random number generator that generates a number within [0, RAND_MAX], and RAND_MAX < UINT_MAX. How do I ...
3
votes
1answer
85 views

Fast algorithm for computing matrix square root using randomized linear algebra?

Is there a fast algorithm for computing the matrix square root of a real symmetric matrix using random matrices or randomized algorithms?
1
vote
1answer
43 views

Creating dense random configuration in for molecular dynamics

I am creating a random configuration of particles for a molecular dynamics simulation, where I would like to guarantee a certain density. The strategy is as follows: choose randomly the positions of ...
6
votes
1answer
149 views

Generating random numbers for long molecular dynamics simulations

I've written a basic 2D Langevin dynamics simulator in C++, for a particle in a potential, solving the equation: $$M\ddot{X} = - \nabla U(X) - \gamma M \dot{X} + \sqrt{2 \gamma k_B T M} R(t)$$ This ...
0
votes
0answers
72 views

Monte Carlo simulation

I am wondering if I am thinking correct about the following problem : ...
1
vote
1answer
64 views

Shifting points in fortran

Hello I am trying to shift points which have been previously generated in the square area. I am having a trouble with some additional conditions how they should have been shifted. ...
3
votes
1answer
810 views

How do I generate maxwell-boltzmann variates using a uniform distribution random number generator?

I am doing a molecular dynamics simulation. I need to assign initial velocities to the atoms. I want to assign the initial velocities which follow the maxwell-boltzmann distribution. How do I ...
0
votes
1answer
23 views

Generating pseudorandom sequences based on measured sequences

I'm looking for an algorithm to generate discrete-time pseudorandom sequences based on other sequences I already have that would be used to train the algorithm. More specifically, I have some time-...
2
votes
1answer
131 views

solving for unknown inside an expectation

I have a an equation that need to find its root. The function is the following $f(\theta) \equiv E[R(\theta;\eta)]=0$ for some unknown $\theta$ which is deterministic, while the expectation is taken ...
1
vote
1answer
88 views

Computing expectations

I want to compute the following conditional expectation $E_{t}[\phi(A_{t+1}, \eta_{t+1})| A_t]$ where $\log A_{t}=\rho \log A_{t-1} + e_{t}$ and $e_{t}$ is IID $N~(0,\sigma_e)$ and $\eta_{t}$ is ...
0
votes
0answers
35 views

Solving a nonlinear equation with a Markov process and RVs

Assume that we have the following equation and the following assumption. The scope is to solve for some particular variables expressed later. Update $$E_{t}\left[ b(A_{t+1})^{1-\gamma} *R_{t+1}^{-\...
2
votes
1answer
147 views

Solving a nonlinear equation with random variable

I would like to solve an equation that looks like this UPDATE $E[(R^{1-\gamma})(r_k+\theta-r_z)]=0$ , where $R=\phi r_z+(1-\phi)(r_k+\theta)$ and $\phi\in[0,1]$, $\theta$, is a random variable ...
1
vote
1answer
530 views

Calculating periodicity of a pseudo random number generator (Middle-square method) [closed]

Below is a Python code that calculates the periodicity of the middle-square method for a given 4 digit-numbers: ...
0
votes
1answer
286 views

Drunken Man in Matlab

I wrote a script that plots the results of the "drunken lamppost" problem in MATLAB. Now I need to create a road-width from -3 to +3, length from 0 to infinity but the drunk can walk just ahead. It ...
2
votes
1answer
104 views

What is the name of the optimization algorithm that uses random sampling?

I am generating random weight as per e.g. below. The I generate a set of 3 values say 100, 250, 300 and I multiple them with the weights below Initial population. ...
7
votes
1answer
88 views

Shall I derandomize a randomized algorithm in real application?

In general (and in real application), suppose I am using a randomized algorithm (e.g. Use MCMC to sample from a distribution and then compute $E(f(x))$ for some function $f$) Assume my algorithm will ...
5
votes
2answers
570 views

Hashing algorithms/implementations for Monte Carlo simulation

To summarise this question in advance, I'm looking for a good hash function that is suitable for generating pseudo-random numbers in Monte Carlo simulations. This means it should be reasonably fast (...
3
votes
0answers
339 views

Generating pseudo-random orthonormal bases for random projection

I am performing series of random projections i.e. projecting the input matrix onto randomly generated orthonormal bases (of much lower dimensionality). The projection is just a matrix multiplication ...
5
votes
1answer
63 views

Random access random permutations

I have a large number of parallel processes and a large integer $n$, and want to randomly partition the integers $[0,n)$ among the processes with only $O(1)$ communication. One nice way to do this ...
2
votes
1answer
77 views

Randomly choose among N alternatives

I understand how to generate a random sequence of binary variables where 1 occurs with probability p and ...
5
votes
4answers
1k views

Simulated Annealing proof of convergence

I implemented downhill simplex simulated annealing algorithm. Algorithm is very hard to tune, w.r.t. parameters including cooling schedule, starting temperature... My first question is about ...
1
vote
1answer
150 views

Random placement of euclidean points with constrained inter-point distances in a fixed area

I'd like to place as many random points as possible in a 2D square $S=[0,1]x[0,1]$ such that the euclidean distance $d$ between any two points $d$ is greater than a given value $b$ (b is small). I'm ...
11
votes
4answers
281 views

How to create a random 3D domain representing a plant's root structure?

I would like to model laminar flow of water from roots to the stem of a plant. At the very end of the roots, the tubes vary from millimeter to centimeter scale in diameter and length. As we get closer ...
5
votes
1answer
4k views

How can I determine the period of my pseudo-random number generator?

Suppose I'm using a linear congruential pseudo-random number generator (PRNG). Given a seed $x_0$, the multiplying factor (a), the shift factor (c) and the modulus factor (m), how can I determine the ...
3
votes
1answer
64 views

Adding deliberate imperfection to RNG output - toolkits?

Are there any existing software toolkits, libraries, frameworks or whatever for studying the quality of pseudorandom number generators that allow one to add a known amount of imperfection - e.g ...
7
votes
4answers
1k views

How can I seed a parallel linear congruential pseudo-random number generator for maximal period?

Normally when I seed a sequential random number generator in C, I use the call srand(time(NULL)) then use rand() mod N ...
6
votes
2answers
3k views

Looking for C/C++ implementations of sampling from multinomial and Dirichlet distributions

I'm looking for C/C++ implementations of functions that return random variates multinomial and Dirichlet distributions. This is in the context of a calculation for posterior predictive p-values, part ...
4
votes
1answer
598 views

Sampling from posterior predictive distribution

First post. I'm working on this problem using Bayesian methods. In desperation I'm considering using p-values (shock horror), specifically posterior predictive p-values. So I need to simulate from the ...
18
votes
4answers
2k views

Is Fortuna or Mersenne Twister preferable as an algorithmic RNG?

A recent answer mentioned the use of Fortuna or Mersenne Twister Random Number Generators (RNGs) to seed a Monte Carlo simulation. I hadn't heard of Fortuna before so I looked it up - looks like it is ...
6
votes
4answers
336 views

How do I know which low-discrepancy sequence to use?

Whenever one uses a quasi-Monte Carlo method for cubature or optimization, it seems that there's a wide variety of low-discrepancy sequences to choose from, associated with the names of van der Corput,...