# Questions tagged [random-number-generation]

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

67 questions
Filter by
Sorted by
Tagged with
1 vote
74 views

• 143
277 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 ...
• 143
504 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 ...
• 389
1 vote
88 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. ...
11k 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 ...
• 203
37 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-...
• 203
1 vote
99 views

### Sampling from the Generalized Beta of the Second Kind in Fortran

I need to sample from the generalized beta of the second kind (GB2) distribution (McDonald, 1984, Econometrica). Its PDF has the form  f_{a,b,p,q}(x) = \frac{|a|x^{ap-1}}{b^{ap}B(p,q)(1+(x/b)^a)^{p+...
• 11
65 views

### Maths calculations for randomly generated numbers don't match computed averages

Ok, It was hard to explain my problem in the title. I hope it made enough sense to peak the curiosity of some of you. What I've been trying to do is find the relationship between the amount of random ...
1 vote
86 views

### optimising changing the range of integers from random number generation

I'm looking to find the most efficient way to change integers from a random number generator to a different inclusive number range. I know of 2 ways so far: Change the number into a decimal in the ...
1 vote
2k 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: ...
• 113
1 vote