Looking for more algorithms for quasi-random numbers
11-29-2019, 01:06 PM (This post was last modified: 11-30-2019 06:16 AM by Namir.)
Post: #1
 Namir Senior Member Posts: 823 Joined: Dec 2013
Looking for more algorithms for quasi-random numbers
Hi All Math Lovers,

In another thread of mine, ttw mentions quasi-random numbers. Quasi-random numbers (QRNs) present a better spread over a range of values than pseudo-random numbers (PRNs). On the other hand, QRNs will often fail randomness tests. They true purpose to to cover more uniformly a range of values in one of more dimensions.

This is part of ttw's response in my other thread, where he mentions QRNs:

Quote:The easiest multi-dimensional quasi-random sequence is the Richtmeyer sequence. One uses the fractional part of multiples of the square roots of primes. Sqrt(2), Sqrt(3), etc. It's quick to do these by just setting x(i)=0 updating by x(i)=Frac(x(i)+Sqrt(P(i))). Naturally one just stores the fractional parts of the irrationals and updates. (List mode). The sequence is also called the Kronecker or Weyl sequence at times.

The above text includes the algorithm of setting x(1)=0 updating by x(i)=Frac(x(i)+Sqrt(P(i))). The array of P() represents prime numbers starting with 2. You can change x(1) to had a uniform random number as a seed (to generate different sequences every time you apply the algorithm) or simply set x(1) = sqrt(P(1)) = sqrt(2).

I am curious about other formulas to calculate sequences of quasi-random numbers. You are welcome to use your imagination. My first attempt was something like:

Code:
n = number of x to generate m = 100*n Calculate P() for primes in the range of 1 to m X(1) = rand or Frac(ln(P(3)) * sqrt(P(1)) j = 2 count = 0 for i=2 to n   X(i) = Frac(X(i) + ln(P(j+1)) * sqrt(P(j-1))   j = j + 1   if j > m then    count = count + 1     j = 2 + count   end end

The above code produces x() with a mean near 0.5 and standard deviation near 0.28. The auto correlations for the first 50 lags are in the orde rof 10^(-2) to 10^(-4).

I am curious about other formulas to calculate sequences of quasi-random numbers. You are welcome to use your imagination. You can even commit math heresy!!! As long as it works, you are fine (and forgiven) :-)

Namir
 « Next Oldest | Next Newest »

 Messages In This Thread Looking for more algorithms for quasi-random numbers - Namir - 11-29-2019 01:06 PM RE: Looking for more algorithms for quasi-random numbers - SlideRule - 11-29-2019, 04:49 PM RE: Looking for more algorithms for quasi-random numbers - mfleming - 11-30-2019, 01:36 AM RE: Looking for more algorithms for quasi-random numbers - Namir - 11-30-2019, 01:29 PM RE: Looking for more algorithms for quasi-random numbers - Namir - 11-30-2019, 07:52 PM RE: Looking for more algorithms for quasi-random numbers - ttw - 12-01-2019, 05:52 AM RE: Looking for more algorithms for quasi-random numbers - Csaba Tizedes - 12-01-2019, 11:46 AM

User(s) browsing this thread: 1 Guest(s)