Deutsch   English   Français   Italiano  
<vd2ece$12u3$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Krishna Myneni <krishna.myneni@ccreweb.org>
Newsgroups: comp.lang.forth
Subject: Re: KISS 64-bit pseudo-random number generator
Date: Wed, 25 Sep 2024 20:45:48 -0500
Organization: A noiseless patient Spider
Lines: 96
Message-ID: <vd2ece$12u3$1@dont-email.me>
References: <vblosf$292ru$1@dont-email.me> <vcfr7j$91t8$1@dont-email.me>
 <a5254f7a5f00a0133c24e70330dabc04@www.novabbs.com>
 <vcgok8$gol7$1@dont-email.me> <nnd$76c078e1$19b846f5@d6ba8ec0a1ab68bc>
 <vch2sb$i6bm$1@dont-email.me> <vd25ij$3s0rd$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 26 Sep 2024 03:45:51 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a7c03aaee466c85bd296880c3af1b9eb";
	logging-data="35779"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19c78G2jRlqLtT7RmH+LI4c"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:2VX81CBnwQlKzgSoUlzYXpT2oA4=
Content-Language: en-US
In-Reply-To: <vd25ij$3s0rd$1@dont-email.me>
Bytes: 5461

On 9/25/24 18:15, Krishna Myneni wrote:
> 
> I've calculated the statistical variation in the moments for each set of 
> N, using 16 different seeds (spaced apart over the interval for UMAX). 
> The standard dev. for the 16 <v^i>, computed for N trials is comparable 
> to the relative error between the moment and its theoretical value. 
> Thus, the relative errors are indeed a meaningful comparison between the 
> two prngs tested here, and I think this implies that for N > 10^5 the 
> LCG PRNG  (RANDOM) gives more accurate answers than the KISS 64 bit PRNG 
> (RAN-KISS), for this problem. The LCG PRNG is faster than the KISS 
> 64-bit PRNG. ...

The revised test tables for 64-bit prngs RANDOM and RAN-KISS, below, 
include the statistical variations of the moments as a result of 
changing the seed for the prng. These variations are presented as the 
scaled standard deviations for a set of 16 moments, each computed with a 
different seed. The standard deviations, for a given N,

{s1, s2, s3} = {sd({<v>(x_i)}), sd({<v^2>(x_i)}), sd({<v^3>(x_i)})}

where x_i, i=1,16 represents the seed for the random number generator, 
{<v^j>(x_i)} represents the set of 16 computed moments for each power of 
v, j=1,2,3, and the averaging over the v^j is for N trials.

These computed standard deviations are scaled by the moments in order to 
compare these variations with the relative error in the moments,

s_j/<v^j>

The relative error, |e_j|, is defined by

|e_j| = |(<v^j> - <v^j>_th)| / <v^j>_th

where <v^j>_th is the value of the j^th moment, computed from the 
analytic integral, using the M-B probability density function.

For example, for the prng RANDOM tests, at N=10^7, the magnitude of the 
relative error in <v^3>, |e3|, is 4.27e-05 for a random draw of 10^7 
speeds from a Maxwell-Boltzmann distribution. If we repeat this same 
computation 16 times, each time with a different seed, and look at the 
normalized standard deviation s3/<v^3> (for N=10^7), this is 3.01e-04.

Comparing both the relative errors and statistical variations due to 
using different seeds, the tables below show that RANDOM gives 
consistently lower relative errors and statistical seed variations than 
RAN-KISS, for N >= 10^5.

--KM


=== RANDOM PRNG TESTS ===
' random test-prng

Moments of speed
  N       <v> (m/s)    <v^2> (m/s)^2    <v^3> (m/s)^3
10^2     1220.2444     1761665.1       2879481740.
10^3     1258.2315     1844889.5       3025976380.
10^4     1250.0696     1837249.9       3055346856.
10^5     1259.9899     1870367.4       3143506292.
10^6     1259.3923     1868383.4       3136761299.
10^7     1259.6343     1869366.9       3140010276.

Relative Errors                        Seed Variations
  N       |e1|       |e2|       |e3|    s1/<v>    s2/<v^2>  s3/<v^3>
10^2  3.13e-02   5.77e-02   8.30e-02   4.70e-02  9.67e-02  1.54e-01
10^3  1.19e-03   1.32e-02   3.64e-02   1.32e-02  2.44e-02  3.59e-02
10^4  7.67e-03   1.73e-02   2.70e-02   4.43e-03  8.24e-03  1.22e-02
10^5  2.08e-04   4.44e-04   1.07e-03   1.11e-03  1.95e-03  2.78e-03
10^6  2.66e-04   6.18e-04   1.08e-03   2.82e-04  6.78e-04  1.27e-03
10^7  7.39e-05   9.15e-05   4.27e-05   7.76e-05  1.72e-04  3.01e-04

=== RAN-KISS PRNG TESTS ===
' ran-kiss test-prng

Moments of speed
  N       <v> (m/s)    <v^2> (m/s)^2    <v^3> (m/s)^3
10^2     1212.8900     1702106.0       2666594142.
10^3     1274.7097     1900519.4       3190481667.
10^4     1259.6892     1866276.3       3123781859.
10^5     1260.4578     1872500.5       3147907366.
10^6     1260.2589     1871249.6       3145073404.
10^7     1259.8296     1869882.9       3140954422.

Relative Errors                        Seed Variations
  N       |e1|       |e2|       |e3|    s1/<v>    s2/<v^2>  s3/<v^3>
10^2  3.72e-02   8.96e-02   1.51e-01   4.07e-02  8.72e-02  1.46e-01
10^3  1.19e-02   1.66e-02   1.60e-02   1.26e-02  2.54e-02  3.93e-02
10^4  3.03e-05   1.74e-03   5.21e-03   3.72e-03  6.96e-03  9.85e-03
10^5  5.80e-04   1.58e-03   2.47e-03   1.26e-03  2.41e-03  3.63e-03
10^6  4.22e-04   9.16e-04   1.57e-03   4.89e-04  9.75e-04  1.51e-03
10^7  8.11e-05   1.85e-04   2.58e-04   1.25e-04  2.54e-04  3.99e-04