The Mersenne Twister Output Stream Postprocessing Yurii Shcherbyna 1, Nadiia Kazakova2, Oleksii Fraze-Frazenko3 1 National University "Odesa Law Academy", Rishelievska st., 28, Odesa, 65011, Ukraine 2,3 Odesa State Environmental University, 15 Lvivska str., Odesa, 65016, Ukraine Abstract Today, pseudo-random number sequence generators are actively used to solve a large number of applied problems of statistical and simulation modeling in such areas as telecommunications networks, automated control systems for production processes and infrastructure, security systems and others. Such generators have serious requirements for the sequence of numbers that they generate at their outputs. These are, first of all, the requirements for their randomness. The original sequences should be almost indistinguishable from the truly random ones. And, most importantly, they must also ensure a high uniformity of probability distribution of the original numbers. It is shown that the non-uniformity of numbers at the output of the primary generator significantly affects the quality of modeling of stochastic processes that take place in systems for which computer models are built. Tests on a linear congruent generator and a Mersenne twister (MT) generator have shown that the flow of decimal real numbers at their outputs does not fully meet the needs of modern computer modeling. The vast majority of tests of such flows using the Pearson chi-square test gives an unsatisfactory result. Based on the analysis of post-processing methods of numerical sequences, it is proposed to perform preliminary thinning of the input in relation to the model of the numerical flow by removing elements that do not fit into the uniform distribution. The expected sum of random real numbers to be included in each of the segments of the random number distribution histogram is chosen as the thinning criterion. It is shown that the use of this method of post-processing of the primary generator does not require extra computing resources of the system. Keywords 1 Simulation, linear congruent generator, Mersenne twister generator, inverse function method, Pearson chi-square test, post-processing of numerical flow. 1. Introduction random variables evenly distributed on the interval [0, 1] is created, and only then a sequence of numbers is formed from them, which If in the second half of the last century corresponds to the given probability distribution modeling was considered a secondary stage in the law. Because computing devices are deterministic design of complex systems, today the modern automata, they can only output pseudo-random development of computer technology numbers (PRN) with a limited repetition period of significantly increases its importance in the study T. For efficient modeling, PRN generation of stochastic processes that occur in modern algorithms must provide high speed, long production, infrastructure management and repetition periods, and good statistics. [1]. economic activity. Libraries of modern programming languages Usually the modeling of random processes already contain PRN generators with a uniform takes place in two stages: first a sequence of distribution law, which return the number π‘ˆπ‘– from III International Scientific And Practical Conference β€œInformation Security And Information Technologies”, September 13–19, 2021, Odesa, Ukraine EMAIL: shcherbinayura53@gmail.com (A. 1); kaz2003@ukr.net (A. 2); frazenko@gmail.com (A. 3) ORCID: 0000-0003-3885-6747 (A. 1); 0000-0003-3968-4094 (A. 2); 0000-0002-2288-8253 (A. 3) ©️ 2021 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop Proceedings (CEUR-WS.org) the finite set {0, 1, … , 𝑇 βˆ’ 1}. It is also possible to computing resources. In view of this, the aim of connect external libraries offered by different the study is to select and justify an additional developers. Most traditional PRN generators are method of converting a sequence of pseudo- well described by Donald Knuth in [2], where he random numbers at the output of the MT generator concludes that they are of insufficient quality and to ensure a given level of uniformity of their unsuitable for research needs. distribution. The vast majority of PRN cryptographic generators developed in recent decades have been 3. Methods of post-processing described in detail by Bruce Schneier in [3], but they are hardly suitable for computer simulation. The general idea of additional processing of First, their use requires significant computing numbers at the output of the generator was resources, which significantly reduces their formulated long ago, when the main source of efficiency, and secondly, they ensure uniform distribution at the binary level. As shown in [4], random numbers were physical noise occurring in electronic devices, such as electronic lamps, the transformation of a binary sequence into a quantum generators and the like. Its essence is to decimal format and its subsequent scaling leads to sacrifice a certain number of numbers at the a significant loss of uniformity. output of the generator for the sake of obtaining Recently, an algorithm known as the Mersenne Twister (MT) has been proposed for modeling an output stream that would satisfy the conditions. purposes, which provides an extremely long Later, von Neumann remarked on the inadmissibility of using physical generators in repetition period 219937 βˆ’ 1 [5]. It, together with computer technology, because due to technical the linear congruent generator (LCG) [6], is part difficulties the possibility of re-implementing the of the libraries of almost all known specialized obtained sample of random numbers at that time software environments designed to solve research and engineering problems. was absent and, therefore, proposed algorithms for generating pseudo-random numbers as the The two-stage modeling scheme is very method of mean squares [10 ] and the linear sensitive to the uniform distribution of numbers at congruent method. But, as shown by D. Knuth [4], the output of the selected generator. As shown by they also did not provide the necessary uniformity checking the flow of real numbers generated by LCG and MT using Pearson's πœ’ 2 -test, up to half of of the formed numerical flow. Since it is almost the samples, regardless of their size, are not tested impossible to make an ideal generator, the idea of post-processing for both real random number for uniformity. generators and PRN generators remains relevant. Since the choice of PRN generator is At the moment, we can identify the following extremely limited for researchers, this problem four methods of post-processing: [9]. should be solved by upgrading the numerical flow at the output of the PRN generator. 1. Ad hoc simple correctors. 2. Whitening with hash functions. 3. Extractor algorithms. 2. The aim of the study 4. Resilient functions. The general requirement for all methods of To check the quality of pseudo-random post-processing is the minimization of resources number generators, a large number of test packets for their implementation. were created [7,8] and all of them perform the An example of a simple corrector is the analysis of the output stream at the binary level. corrector described by von Neumann in [10] This is due to the fact that they are mainly where he proposes to combine a pair of bits intended for testing cryptographic generators obtained from independent sources on the focused on the performance of quenching principle: if the bits match (00 or 11), the bits are operations, which are performed bit by bit. canceled, the combination of bits 01 corresponds Divided into bytes and converted to a decimal to 0-th the output bit, and the combination 10 sequence of real numbers, a binary sequence does corresponds to the 1st output bit. The maximum not necessarily remain evenly distributed. In most efficiency of such an algorithm is on average 4 cases, it is necessary to perform its post input bits per 1 output bit. It was in this work that processing [9], choosing a method that would give von Neumann emphasized the difficulty of a satisfactory simulation result and, at the same generating random decimal numbers. time, was effective in terms of the use of Later, other, more advanced versions of where the random variable X has a minimum similar correctors were proposed, but they also entropy π‘˜, and π‘ˆπ‘‘ is a uniformly distributed work at the bit level. quantity on {0,1}𝑑 . The mechanism of operation of Whitening is a method that reduces the the randomness extractor is shown in Figure 1. correlation of symbols at the output of the entropy source and increases the homogeneity and uniformity of the distribution of symbols in the output stream. It is usually performed using hash algorithms, such as MD5, SHA-1, SHA-2, SHA- Figure 1: The mechanism of the extractor 256 or SHA-512. This processing is a deterministic algorithm that converts input blocks In [12], another method of amplifying the of characters of arbitrary length into a fixed size randomness of the output flux of the PRN string. In [11] it was shown that bleaching does generator, which is based on its postfiltration not increase entropy and therefore the main task through some deterministic process, is of ensuring randomness should be solved by the considered. His idea is to use the use of elastic PRN generator, and not by the post-processing functions to divide the original characters into algorithm. It should be noted that the term random and "not random enough". In [13], the randomness means the absence of a noticeable elastic function F is defined as the (𝑛, π‘š, π‘˜) - analytical relationship between the symbols at the function 𝑓 ∢ 𝐹 𝑛 β†’ πΉπ‘š , which forms each output k- output of the PRN generator. But, in contrast to bit combination of fixed input bits directly, and cryptographic problems, in modeling it is the others 𝑛 βˆ’ π‘˜ bits are selected randomly. Such important to ensure the uniformity of the functions were created exclusively for the needs distribution of the original numerical flow. of cryptographic transformations. Randomity extractors are algorithms that From the above we can conclude that the work convert a low-quality stream of input values into on creating generators of random and pseudo- an almost uniform stream of numeric characters random numbers is mainly focused on with a small number of guaranteed random bits. cryptographic needs. At the heart of such Formally, the method of such a transformation is generators is a complex computational process, described in the work of Luke Trevisan [12]. To the implementation of which requires significant characterize weak sources of chance, the author computing resources. For modeling purposes, introduces the concept of minimum entropy, either LCG or MT generators are typically used, which characterizes the non-uniform distribution which have unsatisfactory uniformity in the of the quantity 𝑋 in the range {0,1}𝑛 , where n is a distribution of the source symbols, but can be binary combination at the source output. In the subject to post-processing methods such as case of a perfectly uniform distribution, all combining streams from multiple sources and combinations will be equally probable and the thinning them by removing symbols that look like entropy will be maximum, otherwise it will be β€œ not random enough ”. smaller. If the minimum entropy of such a source has a value of at least k, then for each π‘₯ ∈ {0,1}𝑛 4. Post-processing of a numerical the condition Pr[𝑋 = π‘₯] ≀ 2βˆ’π‘˜ is fulfilled. The task of the extractor is to convert the flow X into almost stream from the MT generator uniform. To quantify the output flow, the concept of statistical difference πœ– between two random Computer simulation of random processes variables X and X in the range {0,1}𝑛 is used, such as request flows in telecommunication which is defined as: systems [1], flows of attacks on information system resources [14], or failures of technical |𝑝[𝑇(𝑋) = 1]| βˆ’ |𝑝[𝑇(π‘Œ) = 1]| ≀ πœ– (1) equipment in computer systems, involves the use of procedures containing elements of randomness In the general case, the (π‘˜, πœ–) -extractor implemented using built based on number theory converts the flow of random variables X into an and numerical analysis of optimally selected almost uniform flow by the rule: deterministic systems. Such systems are understood as arithmetic generators of pseudo- 𝐸π‘₯𝑑 ∢ {0,1}𝑛 Γ— {0,1}𝑑 β†’ {0,1}π‘š , (2) random numbers, which are based on recurrent relations. This means that each subsequent number at the output of the generator is determined by one or more pre-formed numbers and the flow of such numbers will be repeated regularly with period 𝑇. Despite this dependence, the numbers generated by the generator should look independent throughout the period. only in the case of their absolutely uniform distribution. Such numbers, evenly distributed on the interval [0, 1], are most often used for modeling purposes. Figure 2: Histogram of the distribution of PRN They must meet the following requirements: obtained by the function rand() 1. the sequence must have the properties of uniform distribution of random numbers in A check of the quality of the distribution using the interval [0, 1] throughout the repetition the πœ’ 2 βˆ’test showed that more than two-thirds of period 𝑇; the samples do not meet the requirements of 2. each fragment of the sequence within the uniformity. Figure 3 shows the distribution of the period 𝑇, from the output of the generator number of hits in each of the 16 intervals of the must have the properties of uniform histogram, Figure 2. Here are the limits of the distribution. intervals of the histogram (Xmin, Xmax), the The first condition is not met by the definition probability of hitting the number in the interval of PRN, but this shortcoming developers are (Pi), the number of hits in the interval (Ni) and trying to compensate by creating algorithms for components indicator πœ’ 2 βˆ’-test (Hi), for each generating numbers with too long a repetition specific interval of the histogram. period. Both LCG and MT generators have fairly long periods. The problem for them is the need to initialize them with a real random number, but it is quite simply solved by forming such a number from the current time. The second condition can be formally described as follows. The general sequence π‘₯1 , π‘₯2 , … can be considered completely uniformly distribute (CUD), if for any 𝑠 β‰₯ 1 part of this sequence (π‘₯𝑛 , π‘₯𝑛+1 , … , π‘₯𝑛+𝑠+1 ) 𝑛 = 1, 2, … will also be evenly distributed. In [6] it was shown that the LCG developers tried to provide satisfactory generator characteristics with the optimal ratio of the coefficients π‘Ž, 𝑐, π‘š of the recurrent ratio 𝑋𝑛+1 = (π‘Žπ‘‹π‘› + 𝑐) π‘šπ‘œπ‘‘ π‘š. (3) As practice shows, the function rand() is built into most modern programming environments and uses as a module π‘š 32-bit machine bit word, Figure 3: Boundaries of histogram intervals and which provides a period of repetition of numbers T at the output of the generator, which does not distribution of sample numbers between them exceed the value of π‘š = 232 . As for the uniformity The total quality index according to Pearson's of the distribution of the output stream, it remains πœ’ 2 βˆ’-test is calculated by the formula extremely low. Figure 2 shows an example of a histogram of π‘˜ (4) (𝑛𝑖 βˆ’ π‘π‘–βˆ— )2 the distribution of numbers at the output of the πœ’2 = βˆ‘ , LCG, obtained using the function rand(), which is π‘π‘–βˆ— 𝑖=1 part of the library C ++. The value of the sample where π‘˜ – this is the number of segments of the N is 1024 numbers, and the number of intervals of histogram, 𝑛𝑖 and π‘π‘–βˆ— – the number of random the histogram is 16. numbers of the output stream that actually fell in the i-th interval and their expected number, respectively. The expected number with uniform 𝛼 distribution π‘π‘–βˆ— is defined as 𝑁/π‘˜ and for the given 𝐹(π‘₯, 𝛼, 𝛽) = 1 βˆ’ 𝑒 βˆ’(π‘₯/𝛽) . (5) example is 64. Similar tests were performed for the MT where 𝛼 – is a scale parameter, 𝛽 – form generator. Unlike the LCG generator, it has a parameter, Π° π‘₯ – variable. 𝛼 Ρ– 𝛽 – are fixed values much longer repetition period, which is equal to for which the conditions 𝛼 > 0, 𝛽 > 0 must be 19937 met. In case if 𝛽 = 1, Weibull's distribution 𝑇=2 βˆ’ 1 bits, and the algorithm embedded in it provides very little correlation between two coincides with the exponential distribution. samples from the original sequence of numbers. The inverse function looks like: The developers of the generator claim that it 𝐹 βˆ’1 (π‘₯) = 𝛽[βˆ’ln (1 βˆ’ π‘₯)]1/𝛼 . (6) passes the tests of the DIEHARD package [8]. However, all the declared positive qualities of We assume that at the output of the MT such a generator are valid for a binary sequence. generator there is a flow of numbers 𝑦1 , 𝑦2 , … Tests of real numbers distributed in the interval which express the probability of events of the [0, 1] using the πœ’ 2 βˆ’test showed that only 10 ο‚Έ 15 random Weibull process. Then, using relation (6), percent of samples from the output stream from we can obtain a stream of numbers π‘₯1 , π‘₯2 , …, the MT generator give a positive test result. which in accordance with this principle, is Figure 4 shows an example of a histogram of determined by relation (5) and expresses the the distribution of numbers at the output of MT, argument of the distribution function. obtained using the function Next, we construct a histogram, on the basis of uniform_real_distribution<> mersenne(0, 1) from the which we calculate the quality index by the πœ’ 2 - library C ++ test. The choice of this criterion is determined by the fact that, firstly, its use is not limited to the type of distribution and, secondly, if this criterion is not met, then all other criteria, too, are unlikely to be met. A separate issue in the special literature is the choice of the number of segments of the histogram. They should be sufficient so that the Figure 4: Histogram of the PRN distribution shape of the histogram in its form as close as obtained using the function possible to the form of the Weibull distribution uniform_real_distribution<> mersenne(0, 1) density function described by the expression: The sample size N, as in the case of the LCG 𝛼 π›Όβˆ’1 βˆ’(π‘₯/𝛽)𝛼 (7) 𝑝(π‘₯) = π‘₯ 𝑒 . generator, was equal to 1024 real decimal 𝛽𝛼 numbers, and the number of intervals of the histogram k was also equal to 16. On the other hand, the number of segments should To model stochastic processes, the method is not be too large so as not to lose the filtering most often used, the essence of which is that on capabilities of the histogram, as is the case with the basis of the conditions of inverse functions and signal quantization. Today there are several the theorem according to which a continuous different ways to determine their number and the random variable π‘₯, with an arbitrary distribution most popular is the formula proposed in 1926 by having a probability distribution function 𝐹(π‘₯), Sturges [16] determines a continuous uniformly distributed on π‘˜ = 1 + βŒŠπ‘™π‘œπ‘”2 π‘βŒ‹ (8) the interval [0, 1], the random variable 𝛾 = 𝐹 βˆ’1 (𝛾) [15]. This method works well when the where π‘˜ number of histogram segments, and 𝑁 – process can be described analytically and the the number of characters in the random number inverse function 𝐹 βˆ’1 (π‘₯) exists for it. sample. This formula is derived from the binomial To evaluate the numbers distribution distribution and implicitly assumes work with the uniformity influence at the output of the MT normal distribution. generator on the quality of the simulation, There are other formulas that also allow you to consider the example of creating a numerical determine the approximate number of segments. flow, which is described by the Weibull function A good option is the formula proposed in 1981 by with two parameters. It looks like this: Freedman and Diaconis [17], which gives the length of the segment h, expressed in terms of interquartile range (the distance between the end Figure 5, 16 segments of the histogram will be of the first and the beginning of the last quartile of filled as follows the IQ sample) The table in Figure 6 shows the boundaries of the intervals of the histogram (Xmin, Xmax), the βˆ’1/3 β„Ž = 2 βˆ™ (𝐼𝑄) βˆ™ 𝑁 , (9) probability of hitting the number in the interval (Pi), the number of hits in the interval (ni), the where the number of segments can be defined as expected number of hits in the interval (Ni) and π‘¦π‘šπ‘Žπ‘₯βˆ’ π‘¦π‘šπ‘–π‘› (10) π‘˜= . the component indicator πœ’ 2 -test (Hi). β„Ž where π‘¦π‘šπ‘Žπ‘₯ and π‘¦π‘šπ‘–π‘› are, respectively, the maximum and minimum values of the members of the sample variation series. All the proposed methods for calculating the number of segments of the histogram were determined based on the problem of finding the type of distribution based on the accumulated statistical material and, each time, the researchers proceeded from the features of the process to be evaluated. That is why there are so many ways to determine the value of k. As for the simulation, the inverse problem is solved here, when the method of distribution of random variables is known and, therefore, the value of the number of segments is not so critical and can be determined arbitrarily. If the inverse function method converts a sequence of random numbers from the MT generator into a random Weibull process with the Figure 6: Boundaries of histogram intervals and parameters 𝛼 = 1.3, 𝛽 = 0.1, it will look like their filling for Weibull distribution Figure 5. From the table shown in Figure 6, it is seen that the segments 12 to 16 do not allow to calculate the corresponding components of the indicator πœ’ 2 , and therefore they are combined into one interval, for which 𝑛𝑖 = 9, and π‘›π‘–βˆ— = 8. At the level of five percent error (Ξ» = 0.05) for the given example, its value is πœ’ 2 = 17.723577, which is more than the critical value πœ’2ΠΊΡ€ = 7.290644, and this means Figure 5: The result of modeling a random dissatisfaction with the simulation result. This Weibull process by the inverse function method result is confirmed in the vast majority of An additional problem that arises when subsequent tests and, thus, it can be concluded that estimating an asymmetric random process is that, it is necessary to correct the numerical flux at the taking into account the peculiarities of formula output of the MT generator by post-processing. (4), very few random numbers 𝑛𝑖 fall into the last As can be seen from the above analysis of post- segments of the β€œtails” of the distribution and, processing methods, the vast majority of them therefore, these components of the indicator πœ’ 2 - were developed for cryptography and, therefore, test contributes the lion's share to the error, which are unacceptable for the correction of the brings its value closer to the critical value πœ’ΠΊΡ€2 . In numerical flow at the output of the MT generator due to their excessive complexity. The solution to [2] D. Knuth points out that the sample size N the problem should not burden the computer must ensure that each interval of the histogram system with significant additional resources. hits at least 5 random numbers. To avoid this Given the admissibility of such operations as problem, and since the histogram segments do not combining numerical streams, their "bleaching" have to be the same size, we will combine the last or "sieving", as well as the use of Pearson's πœ’ 2 -test intervals with less than 6 numbers into one to assess the uniformity of number distribution, common interval. For the example shown in we will try to "align" it by removing from its Figure 8: Boundaries of histogram intervals and composition "extra" elements . their filling with numbers from the output of the MT generator after post-processing Figure 7 shows the test results of a sample of length 𝑁 = 1024 real decimal pseudo-random numbers at the output of the MT generator after post-processing as described, and the filling of histogram segments is shown in Figure 8 Now, for Ξ» = 0.05 πœ’ 2 = 0.3438, which is less than critical Figure 7: Histogram of the PRN distribution value πœ’2ΠΊΡ€ = 7.2609.. obtained at the output of the MT generator after post-processing It is expected that in the case of uniform distribution in each segment of the histogram should fall the same number of random numbers equal to π‘π‘–βˆ— = 𝑁/π‘˜. The mathematical expectation of a quantity to be included in a segment bounded by the conditions π‘₯π‘šπ‘–π‘› ≀ π‘₯𝑖 < π‘₯π‘šπ‘Žπ‘₯ is defined as Figure 9: Histogram of the Weibull process, based π‘šπ‘– = (π‘₯π‘šπ‘–π‘› + π‘₯π‘šπ‘Žπ‘₯ )/2. Then the number of on the table in Figure 8 numbers that fall into the i-th segment 𝑆𝑖 , will be approximately equal to the value of π‘†π‘–βˆ— = π‘π‘–βˆ— π‘šπ‘– . Of The Weibull process formed by the method of course, each time this sum will be either less than the inverse function of the numbers from the MT π‘†π‘–βˆ— , or more than π‘†π‘–βˆ— , but there will be no significant generator after their post-processing gives difference. This makes it possible to formulate significantly better results. The histogram such an algorithm. If the sum of the numbers 𝑆𝑖 constructed on the basis of such flow is shown in that fall into the i-th segment of the histogram figure 9. exceeds the value of π‘†π‘–βˆ— , then all other numbers The table in Figure 10 shows the distribution that fall into it are skipped. Of course, the number of numbers in the segments of the histogram of numbers in the segments will remain different, shown in Figure 9 and the components of the πœ’ 2 - but the unevenness of the sample will be smaller. test. Figure 10: Boundaries of histogram intervals and distribution of numbers between them for Weibull distribution after post-processing For the given example for Ξ» = 0.05 , πœ’ 2 = Modeling-and-Analysis-Averill-M.-Law- 2 4.10807, which is less than the critical value πœ’ΠΊΡ€ = Edisi-5-2014.pdf 7.260944. [2] D. E. Knuth, The Art of Computer Subsequent tests showed that the use of the Programming, Volume 2: Seminumerical proposed method of "thinning" the input stream Algorithms, 3rd. ed., Boston, Mass, USA : from the MT generator, gives significantly better Addison-Wesley, Longman Publishing, simulation results in terms of their reliability. Addison-Wesley, Reading, Mass, 1998. URL: https://doc.lagout.org/science/0_Computer% 5. Conclusions 20Science/2_Algorithms/The%20Art%20of %20Computer%20Programming%20%28vo The experience of modern computer modeling l.%202_%20Seminumerical%20Algorithms shows that the use of specialized software %29%20%283rd%20ed.%29%20%5BKnut packages such as Boost, Glib, C ++, Python, h%201997-11-14%5D.pdf Ruby, R, PHP, MATLAB and Autoit requires [3] Bruce Schneier, Applied Cryptography, significant computing resources and therefore the Second Edition: Protocols, Algorthms, and simulation of stochastic processes is better Source Code in C, 20. ed., Boston, Mass, performed using common tools programming in USA : Addison-Wesley, Longman languages that allow you to create economical Publishing, Addison-Wesley, Reading, program code. Modern C ++ programming Mass, 1998. doi:10.1002/9781119183471 environments, such as Visual Studio and QT5, are URL: https://lost- a good option. They include a large number of contact.mit.edu/afs/adrake.org/usr/rkh/Book additional libraries containing various PRN s/books/Schneier%20- generators. %20Applied%20Cryptography%202ed%20- Such generators are built on the basis of %20Wiley.pdf. recurrent algorithms and do not provide a given [4] J. H. Ahrens, U. Dieter, A. Grube, Pseudo- level of uniformity of distribution of real numbers random numbers. Computing 6 (1970) 121- in the output stream and, therefore, their use for 138). URL: modeling significantly affects its quality. https://doi.org/10.1007/BF02241740. The problem of improving the quality of [5] Saito, M. An Application of Finite Field: modeling can be solved by supplementing the Design and Implementation of 128-bit algorithm for calculating operations that provide Instruction-Based Fast Pseudorandom pre-randomization of the input stream. As such Number Generator. Dept. of Math. Graduate operations, you can use the removal of the original School of Science, February 9th, 2007. URL: numbers, the presence of which violates the http://www.math.sci.hiroshima-u.ac.jp/~m- uniformity of the distribution of the primary mat/MT/SFMT/M062821.pdf. generator. One way to implement such an [6] Niederreiter H. Quasi-Monte Carlo methods algorithm is to limit the number of characters in and pseudo-random number. doi: each segment of the histogram by the value of the https://doi.org/10.1090/S0002-9904-1978- expected sum of random numbers, which is 14532-7. URL: determined by the mathematical expectation of https://www.ams.org/journals/bull/1978-84- the number in the segment and the expected 06/S0002-9904-1978-14532-7/S0002-9904- number of numbers in the segment. Tests show 1978-14532-7.pdf. that the unevenness of the primary generator with [7] A Statistical Test Suite for Random and this method of post-processing has almost no Pseudorandom Number Generators for effect on the quality of modeling. Cryptographic Applications. SP 800-22 Rev. 1a, April 2010. URL: 6. References https://nvlpubs.nist.gov/nistpubs/Legacy/SP/ nistspecialpublication800-22r1a.pdf. [1] Averill M. Law. Simulation modeling and [8] The Marsaglia Random Number CDROM analysis, 5th. ed., McGraw-Hill Education, 2 including the Diehard Battery of Tests of Penn Plaza, New York, 2015. URL: Randomness, 1995. URL: https://industri.fatek.unpatti.ac.id/wp- http://ftpmirror.your.org/pub/misc/diehard/. content/uploads/2019/03/108-Simulation- [9] Mario StipčeviΔ‡, True Random Number Generators. Open Problems in Mathematics and Computational Science, Open Problems [14] Shcherbyna, Y. Analysis of attacks in in Mathematics and Computational Science modern cyberphysical systems , Kazakova, 275-315) doi:10.1007/978-3-319-10683-0_12 N. , Fraze-Frazenko, O., Parchuts, L. , URL: Schneider, S. CEUR Workshop Proceedings, https://www.researchgate.net/publication/29 2019, 2683, pp. 12-14 9824248_True_Random_Number_Generato [15] Ross S. A First Course in Probability. 8th rs. Edition. 2010. ISBN-13: 978-0136033134 [10] J. von Neumann. Various techniques for use URL: in connection with random digits. Applied http://julio.staff.ipb.ac.id/files/2015/02/Ross Math Series, Notes by G. E. Forsythe, in _8th_ed_English.pdf National Bureau of Standards, Vol. 12, 36 – [16] Sturges, H. (1926) The choice of a class- 38, 1951. URL: interval. J. Amer. Statist. Assoc., 21, P. 65– https://mcnp.lanl.gov/pdf_files/nbs_vonneu 66. URL: mann.pdf. https://www.tandfonline.com/doi/abs/10.10 [11] Sunar, B. Martin, W. J. Stinson, D. R. A 80/0162 Provably Secure True Random Number [17] Freedman, D. and Diaconis, P. (1981) On Generator with Built-in Tolerance to Active this histogram as a density estimator: L2 Attacks doi:10.1109/TC.2007.250627 URL: theory. Zeit. Wahr. ver. Geb., 57, 453–476. https://cs.uwaterloo.ca/~dstinson/papers/rng URL: -IEEE.pdf. https://bayes.wustl.edu/Manual/FreedmanDi [12] Trevisan L. Extractors and Pseudorandom aconis1_1981.pdf Generators 1999. Journal of the ACM URL: http://theory.stanford.edu/~trevisan/pubs/ext ractor-full.pdf [13] Reshef, Yakir. On Resilient and Exposure- Resilient Functions. 2009. URL: https://www.math.harvard.edu/media/reshef. pdf.