Natural Test for Random Numbers Generator Based on Exponential Distribution

: We will prove that when uniformly distributed random numbers are sorted by value, their successive di ﬀ erences are a exponentially distributed random variable Ex( λ ). For a set of n random numbers, the parameters of mathematical expectation and standard deviation is λ = n − 1 . The theorem was veriﬁed on four series of 200 sets of 101 random numbers each. The ﬁrst series was obtained on the basis of decimals of the constant e = 2.718281 . . . , the second on the decimals of the constant π = 3.141592 . . . , the third on a Pseudo Random Number generated from Excel function RAND, and the fourth series of True Random Number generated from atmospheric noise. The obtained results conﬁrm the application of the derived theorem in practice.


Introduction
Random numbers generators are applicable in various areas, such as: Computer simulation, Monte-Carlo method, multiple integration, nonconvex global optimization, scientific computing, commercial finance, electronic gambling equipment (including on-line gambling), and other fields. The modern world 'exploits' a huge amount of random numbers. Especially in the field of information security, which is based on the cryptography where encryption key randomness is essential [1,2], the quality of random numbers is directly related to the secure transmission of information [3].
One of the basic functions of the human brain is the ability to generate random numbers [4,5]. There are significant differences in activities of particular brain centers during the processes of generating ordinal numbers and random numbers. The inability of a person to generate random numbers may indicate possible disorders. Furthermore, distinctions in brain functions while generating random numbers may significantly imply certain diseases: Dementia of the Alzheimer type, schizophrenia, multiple sclerosis, and Parkinson's disease [6][7][8][9]. Nonetheless, the human brain as the natural source of random numbers does not represent a significant quantitative capacity. The ability to mimic natural entropy is obviously an extremely intellectual demand. However, materialized mental models with computers completely eliminate this deficit.
described with memoryless properties (2): Theorem 1. If the random events {t1, t2, t3, … , tn, tn+1} are independent and uniformly distributed on the arbitrary interval, arranged so that ∀i∈ [1, n], ti ≤ ti+1, then the intervals between the successive random events Ti−1 = (ti − ti−1) are such that ∀i∈ [1, n], ti ≤ ti+1 has the exponential distribution with the values of mathematical expectation and standard deviation reciprocal to the number of random events n.
Proof. The procedure of proving the Theorem will be derived by mathematical induction. For this purpose, we need to find the first, second, and third moment of the distribution of intervals between the successive random events Ti−1.
Let the distribution function and the density distribution of the random variable T be equal to F(T) if (T) = F′(T). We need to find the density f(T • ) of the interval T, that is, the point S randomly distributed in the intervals A and B.
Random variables T and T • , do not have the same functions and density distributions, f(T) ≠ f(T • ) and F(T) ≠ F(T • ). The probability of an arbitrary choice of the interval from the point S is proportional to the length of the interval. In a greater number of repetitions, the point S will more often fall on the longer intervals than on the shorter ones. Therefore, we can conclude that the choice probability of the interval T • is higher than the average choice probability of the interval E(T) ≤ E(T • ).
The density distribution of the event T • in the interval (ti−1, ti) is equal to f(T • )dT. If n intervals are defined, then the average number of intervals is equal to n⋅f(t)dt, and the average length of all intervals is equal to t⋅n⋅f(t)dt. If the average f(T) is equal to E(T), then the average length of all n intervals is equal to n⋅E(T). Probability f(T • )dT is approximately equal to the ratio between the sum of intervals with the length between ti−1andti and the total length of all intervals between the moments of the event appearance. This approximate equality is more accurate if the interval (ti−1, ti) is longer and the number of intervals greater. The density of the random variable T • is equal to (3) [31]: In order to determine the mathematical expectation and variance of the random variable T • it is necessary to determine the characteristic function of the random variable T (4): Theorem 1. If the random events {t 1 , t 2 , t 3 , . . . , t n , t n+1 } are independent and uniformly distributed on the arbitrary interval, arranged so that ∀i∈ [1, n], t i ≤ t i+1 , then the intervals between the successive random events T i−1 = (t i − t i−1 ) are such that ∀i∈ [1, n], t i ≤ t i+1 has the exponential distribution with the values of mathematical expectation and standard deviation reciprocal to the number of random events n.
Proof. The procedure of proving the Theorem will be derived by mathematical induction. For this purpose, we need to find the first, second, and third moment of the distribution of intervals between the successive random events T i−1 .
Let the distribution function and the density distribution of the random variable T be equal to F(T) if (T) = F (T). We need to find the density f (T • ) of the interval T, that is, the point S randomly distributed in the intervals A and B.
Random variables T and T • , do not have the same functions and density distributions, f (T) f (T • ) and F(T) F(T • ). The probability of an arbitrary choice of the interval from the point S is proportional to the length of the interval. In a greater number of repetitions, the point S will more often fall on the longer intervals than on the shorter ones. Therefore, we can conclude that the choice probability of the interval T • is higher than the average choice probability of the interval E(T) ≤ E(T • ).
The density distribution of the event T • in the interval (t i−1 , t i ) is equal to f (T • )dT. If n intervals are defined, then the average number of intervals is equal to n·f (t)dt, and the average length of all intervals is equal to t·n·f (t)dt. If the average f (T) is equal to E(T), then the average length of all n intervals is equal to n·E(T). Probability f (T • )dT is approximately equal to the ratio between the sum of intervals with the length between t i−1 and t i and the total length of all intervals between the moments of the event appearance. This approximate equality is more accurate if the interval (t i−1 , t i ) is longer and the number of intervals greater. The density of the random variable T • is equal to (3) [31]: Mathematics 2019, 7, 920 4 of 14 In order to determine the mathematical expectation and variance of the random variable T • it is necessary to determine the characteristic function of the random variable T (4): i r , the E(T) and V(T) of the random variable T are equal to (5): The characteristic function of the random variable T • is equal to (6): Since Te Txt = −i ∂ ∂x e ixT , it follows that (7): So that the average value is equal to (8): Since (9) The variance of the random variable T • is (10): If we divide the interval T • , whose event S has been implemented, into two intervals A and B, so that → • The interval A is equal from the previous event t i−1 to the event S → • The interval B is equal from the event S to the following event t i.
The density of the random variable B on the interval T • equals: Due to stationarity, it applies (11): Mathematics 2019, 7, 920

of 14
Subintegral function is greater than zero only for values T • > B, so we get (12): where F(T) is distribution function of the random variable T, i.e., F(T) = T 0 f (T)dT. Thus, the density of a probability distribution for the rest of the variable B from the random point S to the next event is (13): The characteristic function of the random variable B equals (14): Using the partial integration, we get (15): The mathematical expectation of the random variable B equals (16): Since for x = 0 we get the vagueness in the form of "0/0", thus by applying L'Hopital's rule we get (17) [31]: Using the connection k B (0) = − 3E(T) for variance of the random variable B, we get (18): The same applies for the random variable A (19): The density of distribution for the random variables A and B are identical. Provided that the characteristics of the uniform distribution of random events have not changed, the probability distributions T, A, and B are identical. From (17), (18), and (19) we get (20) and (21): Mathematics 2019, 7, 920 6 of 14 The uniformity requirement enables us to form a system of equations with the solutions (22): When we introduce the obtained relationship from Equations (20) and (21), we get (23): The expression for E(T 3 ) from (22) and (23) is (24): By mathematical induction we establish for k = 1, k = 2 and k = 3. The basic conditions of the division of n intervals, from (6), imply mathematical expectation for k = 1 as (25): From (22), it follows that for k = 2 (26): From (24), it follows that for k = 3 (27): Let us assume that for the integer k is fulfilled (28): With the assumption for k, for (k+1) it follows (29): This proves that for every integer ∀n∈N, it is valid (30): Mathematics 2019, 7, 920 7 of 14 The distribution of a random variable T i is exponential because the ratio of moments of the exponential distribution is equal to E(T k ) = k!E k (T). The condition results in the following: The variance and the standard deviation of the distribution of the random variable T is equal to (31): These are the identifiable parameters of the exponential distribution ( Figure 2).
Mathematics 2019, 7, x FOR PEER REVIEW 6 of 13 With the assumption for k, for (k+1) it follows (29): [ ] This proves that for every integer ∀n∈N, it is valid (30): The distribution of a random variable Ti is exponential because the ratio of moments of the exponential distribution is equal to The condition results in the following: The variance and the standard deviation of the distribution of the random variable T is equal to (31): These are the identifiable parameters of the exponential distribution ( Figure 2). Random events {t1, t2, t3, …, tn, tn+1} are independent. Distribution interval {T1, T2, ..., Tn} between successive values of the random events {t1, t2, t3, …, tn, tn+1} is exponential. Independence of random events {t1, t2, t3, …, tn, tn+1} comes directly from (2)-the memoryless of the exponential distribution.

Application of Theorem
Pursuant to the theorem proof, successive differences {T1, T2, ..., Tn}of n independent random numbers{t1, t2, t3, …, tn, tn+1} have an exponential distribution with mathematical expectation and function of distribution density (32): Four series of random numbers were prepared for testing. The first series is formed by successive decimals of the constant e = 2.718281…, the second series is formed by successive decimals of the constant π = 3.141592… The third series of Pseudo Random Numbers, PRNG was generated from Microsoft Excel's RAND function. The fourth series of True Random Numbers, TRNG was generated from atmospheric noise [32]. Table 1 contains a series of these numbers.
Numbers are formed by taking five consecutive decimals. For example, from constant "e" the first random number is 0.271828, the second random number is 0.718281, the third random number is 0.182818, the fourth random number is 0.828182, etc. Through this process, 300 random numbers Random events {t 1 , t 2 , t 3 , . . . , t n , t n+1 } are independent. Distribution interval {T 1 , T 2 , . . . , T n } between successive values of the random events {t 1 , t 2 , t 3 , . . . , t n , t n+1 } is exponential. Independence of random events {t 1 , t 2 , t 3 , . . . , t n , t n+1 } comes directly from (2)-the memoryless of the exponential distribution.

Application of Theorem
Pursuant to the theorem proof, successive differences {T 1 , T 2 , . . . , T n } of n independent random numbers {t 1 , t 2 , t 3 , . . . , t n , t n+1 } have an exponential distribution with mathematical expectation and function of distribution density (32): Four series of random numbers were prepared for testing. The first series is formed by successive decimals of the constant e = 2.718281 . . . , the second series is formed by successive decimals of the constant π = 3.141592 . . . The third series of Pseudo Random Numbers, PRNG was generated from Microsoft Excel's RAND function. The fourth series of True Random Numbers, TRNG was generated from atmospheric noise [32]. Table 1 contains a series of these numbers.
Numbers are formed by taking five consecutive decimals. For example, from constant "e" the first random number is 0.271828, the second random number is 0.718281, the third random number is 0.182818, the fourth random number is 0.828182, etc. Through this process, 300 random numbers in series "e" were formed. The first set consists of numbers beginning with the first to the 101st decimal, the second set consists of numbers starting from the 2nd to 102nd decimals, the third set consists of numbers from the 3rd to 103rd decimals, etc. The 200th set consists of numbers starting from the 200th to the 300th decimal. The sets are formed by translating the decimal. Each subsequent set is obtained by ejecting the first number from the previous set and introducing the next decimal from the series, which enables successive testing of the decimal points.  Table 2 gives an example of the formation of the first six and last two sets of 101 random numbers derived from consecutive decimals of constant e. In total, 200 such sets e(i), i∈ [1,200] with 101 random numbers were formed. Table 2. Two hundred sets of random numbers e(i), i∈ [1,200]. The resulting sets are then sorted by value. Table 3 gives an example of sorting the first six and last two sets with 101 random numbers derived from consecutive decimals of a constant ↓[e(i)], i∈ [1,200], which are shown in the previous Table 2.   In each sorted set ↓[e(i)], i∈ [1,200] with 101 random numbers 100 successive differences are formed ∆↓[e(i)], i∈ [1,200]. An example of consecutive differences in the first six and last two sets is given in Table 4. Table 4. Consecutive differences of sorted random numbers ∆↓[e(i)], i∈ [1,200].

∆↓[e(1)] ∆↓[e(2)] ∆↓[e(3)] ∆↓[e(4)] ∆↓[e(5)] ∆↓[e(6)]
. . .  Based on the theorem, the exponential distributions of a set Δ↓[e(i)], i∈ [1,200] of random numbers are verified by a χ 2 test. Figure 3 gives an example of verification of Δ↓[e(1)] with a significance threshold of p = 0.22811, i.e., of a set of random numbers Δ↓[e(199)] with a significance threshold of p = 0.57509. Verifications of the exponential distributions are given in Figure 3.    Based on the theorem, the exponential distributions of a set Δ↓[e(i)], i∈ [1,200] of random numbers are verified by a χ 2 test. Figure 3 gives an example of verification of Δ↓[e(1)] with a significance threshold of p = 0.22811, i.e., of a set of random numbers Δ↓[e(199)] with a significance threshold of p = 0.57509. Verifications of the exponential distributions are given in Figure 3.   By the same procedure, consecutive differences were formed in 200 sets of random numbers obtained on the basis of successive decimals of a constant π(i), PRNG(i), and TRNG(i), i∈ [1,200]. Figure 5 shows the results of 200 verifications of exponential distributions obtained from differences ∆↓[π(i)], i∈ [1,200] formed on the basis of successive decimals of a constant π(i), previously sorted ↓[π(i)].
From Figure 5, it is obvious that the verifications of sets of random numbers are low verifications p < 0.05. These are the verifications (with the set index): p83 = 0.00809 < 0.05, p84 = 0.00809 < 0.05.
From a total of 200 sets of random numbers obtained based on the decimals of a constant π(i), i∈ [1,200], two sets have a significance threshold of less than 0.05.  Figure 6 shows the results of 200 verifications of exponential distributions obtained from differences Δ↓[PRNG(i)], i∈ [1,200], previously sorted ↓[PRNG(i)]. All verifications were performed by χ 2 test, according to the established standard of 10 classes. The distribution of all 200 obtained significance thresholds is given in Figure 6.
From Figure 6 it is obvious that the verification of sets of random numbers has one low verification p < 0.05. This is the verification (with set index): p167 = 0.04777 < 0.05. Out of a total of i∈ [1,200], one set has a significance threshold of less than 0.05.  All verifications were performed by χ 2 test, according to the established standard of 10 classes. The distribution of all 200 obtained significance thresholds is given in Figure 5.
From Figure 5, it is obvious that the verifications of sets of random numbers are low verifications p < 0.05. These are the verifications (with the set index): p 83 = 0.00809 < 0.05, p 84 = 0.00809 < 0.05.
From a total of 200 sets of random numbers obtained based on the decimals of a constant π(i), i∈ [1,200], two sets have a significance threshold of less than 0.05. Figure 6 shows the results of 200 verifications of exponential distributions obtained from differences ∆↓[PRNG(i)], i∈ [1,200], previously sorted ↓[PRNG(i)].
All verifications were performed by χ 2 test, according to the established standard of 10 classes. The distribution of all 200 obtained significance thresholds is given in Figure 5.
From Figure 5, it is obvious that the verifications of sets of random numbers are low verifications p < 0.05. These are the verifications (with the set index): p83 = 0.00809 < 0.05, p84 = 0.00809 < 0.05.
From a total of 200 sets of random numbers obtained based on the decimals of a constant π(i), i∈ [1,200], two sets have a significance threshold of less than 0.05.  Figure 6 shows the results of 200 verifications of exponential distributions obtained from differences Δ↓[PRNG(i)], i∈ [1,200], previously sorted ↓[PRNG(i)]. All verifications were performed by χ 2 test, according to the established standard of 10 classes. The distribution of all 200 obtained significance thresholds is given in Figure 6.
From Figure 6 it is obvious that the verification of sets of random numbers has one low verification p < 0.05. This is the verification (with set index): p167 = 0.04777 < 0.05. Out of a total of i∈ [1,200], one set has a significance threshold of less than 0.05.  All verifications were performed by χ 2 test, according to the established standard of 10 classes. The distribution of all 200 obtained significance thresholds is given in Figure 6.
From Figure 6 it is obvious that the verification of sets of random numbers has one low verification p < 0.05. This is the verification (with set index): p 167 = 0.04777 < 0.05. Out of a total of i∈ [1,200], one set has a significance threshold of less than 0.05. Figure 7 shows the results of 200 verifications of exponential distributions obtained from differences ∆↓[TRNG(i)], i∈ [1,200], previously sorted ↓[TRNG(i)]. Figure 7 shows the results of 200 verifications of exponential distributions obtained from differences Δ↓[TRNG(i)], i∈ [1,200], previously sorted ↓[TRNG(i)].
All verifications were performed by χ 2 test, according to the established standard of 10 classes. The distribution of all 200 obtained significance thresholds is given in Figure 7.
All sets have a significant exponential distribution for the significance threshold pi > 0.05, i∈ [1,200].

Discussion and Conclusions
The procedure for the application of exponential distribution in the testing of sets of random numbers is as follows: The series of n generated random numbers needs to be sorted by value. Next, succcessive differences are calculated for random numbers sorted by value. The random variable of successive differences needs to have a significant exponential distribution. If the exponential distribution with parameters E(n −1 , n −1 ) is not verified, the set of generated random numbers are dependent and cannot be used.
Although it is the basis of many probabilistic functions, in this particular case it was proven that the constant e cannot be applied as a transcendental source of random numbers. With the fact that it is a sequence of e 2 purely-periodic with a period length of 40 [33], the sensitivity of the theorem is indirectly confirmed. For random numbers obtained from consecutive decimals of constant π, a significant departure from a uniform distribution [34] and randomness [35] was found. For random numbers generated from successive decimals of a constant e over 11.50% of sets are not exponentially distributed with a significance threshold p = 0.05, and for constant π this condition is not fulfilled in 1% of sets. According to results from the Diehard Battery of Tests (monkey tests, GCD, birthday spacing's tests, parking lot test, squeeze test, etc.) the first 10 9 digits of π and e all seem to pass the test very well [36].
It should be noted here that the mean of the significance threshold of all 200 verifications for the number e was E(pe) = 0.526329 and was greater than the mean value of the significance threshold of all 200 verifications for the number π which was E(pπ) = 0.501486. The TRNG series did not meet the condition of exponential distribution in 0.5% (1 of 200), while the TRNG series fully met the condition of the theorem. The mean significance threshold of all 200 verifications for the PRNG series was E(pPRNG) = 0.543097. Although higher E(pe) and E(pπ), it was smaller than the mean significance threshold of 200 exponential distribution verification for TRNG sets-E(pTRNG) = 0.589363. In total, the TRNG series had all significant verifications in all 200 sets of random numbers and had the highest mean of verifications.
The results of the first tests and the comparative results confirm the validity of the theorem. The idea based on the entropy of the exponential distribution and its memoryless properties is expressed in the mutual independence between the generated random numbers. The test is natural because a stochastic function with the highest entropy, an exponential distribution, is introduced into the quality testing of a set of random numbers. All verifications were performed by χ 2 test, according to the established standard of 10 classes. The distribution of all 200 obtained significance thresholds is given in Figure 7.
All sets have a significant exponential distribution for the significance threshold p i > 0.05, i∈ [1,200].

Discussion and Conclusions
The procedure for the application of exponential distribution in the testing of sets of random numbers is as follows: The series of n generated random numbers needs to be sorted by value. Next, succcessive differences are calculated for random numbers sorted by value. The random variable of successive differences needs to have a significant exponential distribution. If the exponential distribution with parameters E(n −1 , n −1 ) is not verified, the set of generated random numbers are dependent and cannot be used.
Although it is the basis of many probabilistic functions, in this particular case it was proven that the constant e cannot be applied as a transcendental source of random numbers. With the fact that it is a sequence of e 2 purely-periodic with a period length of 40 [33], the sensitivity of the theorem is indirectly confirmed. For random numbers obtained from consecutive decimals of constant π, a significant departure from a uniform distribution [34] and randomness [35] was found. For random numbers generated from successive decimals of a constant e over 11.50% of sets are not exponentially distributed with a significance threshold p = 0.05, and for constant π this condition is not fulfilled in 1% of sets. According to results from the Diehard Battery of Tests (monkey tests, GCD, birthday spacing's tests, parking lot test, squeeze test, etc.) the first 10 9 digits of π and e all seem to pass the test very well [36].
It should be noted here that the mean of the significance threshold of all 200 verifications for the number e was E(p e ) = 0.526329 and was greater than the mean value of the significance threshold of all 200 verifications for the number π which was E(p π ) = 0.501486. The TRNG series did not meet the condition of exponential distribution in 0.5% (1 of 200), while the TRNG series fully met the condition of the theorem. The mean significance threshold of all 200 verifications for the PRNG series was E(p PRNG ) = 0.543097. Although higher E(p e ) and E(p π ), it was smaller than the mean significance threshold of 200 exponential distribution verification for TRNG sets-E(p TRNG ) = 0.589363. In total, the TRNG series had all significant verifications in all 200 sets of random numbers and had the highest mean of verifications.
The results of the first tests and the comparative results confirm the validity of the theorem. The idea based on the entropy of the exponential distribution and its memoryless properties is expressed in the mutual independence between the generated random numbers. The test is natural because a stochastic function with the highest entropy, an exponential distribution, is introduced into the quality testing of a set of random numbers.
Certainly, the standard test of the uniform distribution U[0,1] of generated random numbers is also a stochastic test. However, the test of the exponential distribution of consecutive differences between generated random numbers, absorbs the test of uniform distribution. In the case of the non-uniform distribution of generated random numbers, a large number of small and big consecutive differences will appear in the set of generated random numbers, which will prevent the verification of the exponential distribution with a significant threshold. In the case of repeating the same decimals while generating random numbers, a large number of small differences with the same non-verification outcome also occur, etc.
However, in the case of extremely large sets of generated random numbers, their consecutive differences converge to zero. According to the theorem and the parameters of the exponential distribution, the standard deviation of consecutive differences in large sets also converges to zero. This means that the proposed test has limitations, which need to be established. Despite this limitation, the proposed test can be applied for the primary selection of a series of generated random numbers. The estimated limit is based on the rare event standard [37] for the exponential distribution parameter λ = 10 −6 , or 1,000,000 consecutive random decimals.