# Abstract

In (Lawnik M., Generation of numbers with the distribution close to uniform with the use of chaotic maps, In: Obaidat M.S., Kacprzyk J., Ören T. (Ed.), International Conference on Simulation and Modeling Methodologies, Technologies and Applications (SIMULTECH) (28-30 August 2014, Vienna, Austria), SCITEPRESS, 2014) Lawnik discussed a method of generating pseudo-random numbers from uniform distribution with the use of adequate chaotic transformation. The method enables the “flattening” of continuous distributions to uniform one. In this paper a inverse process to the above-mentioned method is presented, and, in consequence, a new manner of generating pseudo-random numbers from a given continuous distribution. The method utilizes the frequency of the occurrence of successive branches of chaotic transformation in the process of “flattening”. To generate the values from the given distribution one discrete and one continuous value of a random variable are required. The presented method does not directly involve the knowledge of the density function or the cumulative distribution function, which is, undoubtedly, a great advantage in comparison with other well-known methods. The described method was analysed on the example of the standard normal distribution.

## 1 Introduction

The generation of pseudo-random numbers is crucial in many fields of science like cryptography, where cryptographically secure pseudo-random numbers are needed e.g. [1] or scientific computations, where often numbers from another than uniform distribution are crucial e.g. [2, 3].

There are many published algorithms that enable the derivation of values from the given probability distribution. One of the most popular is the method of inverse cumulative distribution function determined by the equation [4]:

where *U* is a random variable from the uniform distribution on interval (0, 1), *F*^{−1} is a quantile function and *X* is a random variable with distribution corresponding to *F*.

Another very popular method for pseudo-random numbers generation is the rejection (also called acceptance and rejection) method, which is the implication of the following observation [5]:

if a random point (*X*, *Y*) is uniformly distributed in the region *G _{f}* between the graph of the density function

*f*and the

*x*-axis, then random variable

*X*has density

*f*.

Additionally, in professional literature the methods which allow the generation of pseudo random numbers from a concrete distribution can be found, for example, from the normal one [6, 7, 8, 9]. One of such algorithms is the Box-Muller transformation given by the equations [6]:

where *N*_{1} and *N*_{2} are standard normal random variables, whereas *U*_{1} and *U*_{2} are random variables from uniform distribution.

Apart from these classical methods, there are also ways of constructing chaotic maps solving the so-called inverse Frobenious-Perron problem [10, 11, 12], which enables the construction of recurrences with predefined invariant densities. Iterating such dynamical systems is an easy way of generating pseudo-random numbers. One of such recurrences is in the following form [13]:

where *F* is a given cumulative distribution function, *F*^{−1} is the inverse function to *F* and *U* is the skew tent map. The skew tent map (also called as the asymmetric tent map) is given by the relation:

For each value of parameter *p* ∈ (0, 1), the recurrence (4) is chaotic and has a uniform distribution of the iterated variable. Due to these properties, reccurence (4) is very popular as a component of pseudorandom number generators in cryptographic applications [14, 15, 16].

Transformations in the form of (3) were analyzed in [17]. The derived results indicate that for values of parameter *p* close to 0 or 1, the desired probability distribution of the iterative variable cannot be derived. The reason is a small -– close to zero – value of the Lyapunov exponent, which measures the rates of convergence or divergence of nearby trajectories. The Lyapunov exponent of the dynamical system *x*_{k+1} = *f*(*x _{k}*) is given by the formula:

Furthermore, methods for generating pseudo-random numbers with the use of chaotic maps related only to a specific distribution can be shown, for example the normal distribution with the use of the Weierstrass recurrence, which was firstly shown in [18] and futher analized in [19]. The Weierstrass recurrence can be expressed by the formula:

where 0 < *a* < 1, *b* is a odd number and
*a* close to 1, generates values from the normal distribution.

Another method which applies chaotic maps in pseudo-random numbers generation was shown in [20], where values from uniform distribution are generated. This method may be described by the following procedure:

## Method 1

*Let**U ^{n}* (

*x*)

*denote the n*-

*th iteration of the chaotic map with a uniform distribution starting from initial condition x*.

*Furthermore*,

*let*:

*be a certain pseudo-random set of numbers from continuous distribution with finite support*. *In such case*, *the set*

*where a is a normative coefficient*, *has the distribution similar to uniform*.

The above procedure enables the ”flattening” of continous distribution, i.e. reducing it to the uniform distribution. Furthermore, the accuracy of this process depends on the number of iterations n - if it is too small, then the obtained distribution only ”flattens” the oryginal density functions of (7). The transformation *f* may be chosen as the skew tent map (4). Other examples of chaotic maps with uniform distribution may be found in [21, 22]. Likewise, as recurrence (4), they consist of several independent functions, which may be called as *branches*.

While analyzing the above-described method a natural question arises: Is the process of reduction of any distribution to the uniform distribution reversible? If yes, then in consequence, a new method enabling the generation of pseudo-random numbers from any distribution could be derived. The fact that the transformation described in (8) is a 1D chaotic map means that it is irreversible. However, by additional assumptions the process may become reversible, which is discussed in the next section of this paper.

## 2 Method and analysis

The inversion of a chaotic transformation given, for example, by (4) does not render an unequivocal solution. Yet, knowing which of the *branches* of the transformation were iterated, the chaotic map may be inverted. This may be achieved by finding successive inverse images by means of a inverse function to an appropriate *branch*. Assuming that we have two *branches* that are denoted as ”0” and ”1” (see Fig. 1), any orbit starting from an initial point in (7) creates a certain binary sequence. Thus, by replacing every binary sequence with the appropriate integer number, in consequence, a set of integers is derived. Next, for such set it is possible to calculate the frequency of the occurrence *w _{i}* of particular integers, in accordance with the dependence:

where *n _{i}* denotes the amount of successive integers in the above-mentioned set and

*i*= 0,1,…,2

^{n}− 1.

### Fig. 1

An example of such numerical normalized frequency set is shown in Fig. 2. Conducted numerical analysis has shown, that this set is invariant if the number of elements in (7) changes and the values of parameters *p*, *a* and *n* are fixed. Changing values in the mentioned parameters provides a new set of elements in the form (9).

### Fig. 2

Thus, the algorithm of generating pseudo-random numbers from the given distribution with the use of transformation *f* may be described by the following procedure:

Set the values of the frequency of the occurrence

*w*._{i}In accordance with

*w*, generate an adequate value of discrete random variable i from the set {0,1,…,2_{i}^{n}− 1}.Generate a value of random variable

*u*∈ (0, 1) from the uniform distribution.In accordance with

*i*inverse the value of*u*by calculating*x*=*f*^{−i}(*u*), where*f*is the mapping used to get (9).Return

*x*.

Above-described algorithm is an approximate method of generation of pseudo-random numbers. It can be seen as a form of decomposition method of distributions. The accuracy of the method depends on the values of *w _{i}*, which must be designated for properly large set

*X*with adequate number of iterations n. Next, the derived values of

*w*may be catalogued. Then, to generate the values from the given distribution it is not necessary to know the density function or the cumulative distribution function. This eliminates the first step in above proposed algorithm. In comparison with other methods, such as inversion of the cumulative distribution function, or method of acceptance-rejection, it is, undoubtedly, a great advantage. Nevertheless, the algorithm requires to generate two values of random variables (one discrete and one from uniform distribution) which in comparison with the inversion cumulative distribution method is a disadvantage.

_{i}## 3 Example

The implementation of the above-described method shall be presented on the example of standard normal distribution. Accordingly, taking advantage of (8) and (4) the frequency of the occurrence of specific combinations of the *branches**w _{i}* (9) was calculated. The results are presented in Fig. 2. Next, on the grounds of the frequencies using presented algorithm, a sequence of pseudo-random numbers was generated which numerically calculated density function shown in Fig. 3. The obtained results show good matching of the obtained distribution with the standard normal distribution. Moreover, a series of statistical tests was carried out to verify the properties of the analysed method. The results are compiled in Table 1, certifying that the discussed method enables the generation of pseudo-random numbers from standard normal distribution.

### Fig. 3

### Table 1

Test | Statistics value | p-value | ||
---|---|---|---|---|

p = 0.3 | 3.5324 | |||

n = 6 | p = 0.5 | 0.3252 | ||

p = 0.7 | 80.3513 | |||

p = 0.3 | 1.7116 | |||

Anderson-Darling | n = 7 | p = 0.5 | 0.7574 | |

p = 0.7 | 8.5477 | |||

p = 0.3 | 0.5129 | |||

n = 8 | p = 0.5 | 0.3032 | ||

p = 0.7 | 1.2678 | |||

p = 0.3 | 2.1539 | 0.0312 | ||

n = 6 | p = 0.5 | 0.6770 | 0.4983 | |

p = 0.7 | 9.8800 | 5.0827e-23 | ||

p = 0.3 | 1.0719 | 0.2837 | ||

Kurtosistest | n = 7 | p = 0.5 | 0.2584 | 0.7960 |

p = 0.7 | 2.3718 | 0.0176 | ||

p = 0.3 | 0.6035 | 0.5461 | ||

n = 8 | p = 0.5 | 1.8936 | 0.0582 | |

p = 0.7 | 1.3720 | 0.1700 | ||

p = 0.3 | 4.8205 | 0.0897 | ||

n = 6 | p = 0.5 | 1.5407 | 0.4628 | |

p = 0.7 | 97.808 | 5.7683e-22 | ||

p = 0.3 | 1.8172 | 0.4030 | ||

Normaltest | n = 7 | p = 0.5 | 2.5114 | 0.2848 |

p = 0.7 | 5.8378 | 0.0539 | ||

p = 0.3 | 0.8244 | 0.6621 | ||

n = 8 | p = 0.5 | 3.6235 | 0.1633 | |

p = 0.7 | 2.1188 | 0.3466 | ||

p = 0.3 | -0.4255 | 0.6704 | ||

n = 6 | p = 0.5 | 1.0403 | 0.2981 | |

p = 0.7 | 0.4408 | 0.6592 | ||

p = 0.3 | 0.8174 | 0.4136 | ||

Skewtest | n = 7 | p = 0.5 | 1.5635 | 0.1179 |

p = 0.7 | 0.4605 | 0.6450 | ||

p = 0.3 | 0.6783 | 0.4975 | ||

n = 8 | p = 0.5 | 0.1936 | 0.8464 | |

p = 0.7 | 0.4861 | 0.6268 |

## 4 Conclusions

The method discussed in the paper enables the generation of pseudo-random numbers from a given distribution. It requires the knowledge of the frequency of the occurrence of particular branches of the transformation during the process of generating the uniform distribution described in [20]. However, neither the density function nor the cumulative distribution function are directly used in the method. The method was numerically analysed on the example of standard normal distribution. The obtained results prove its accuracy. It may be applied to create a series of generators of pseudo-random numbers from continuous probability distribution.

### References

[1] Blum L., Blum M., Shub M., A Simple Unpredictable Pseudo-Random Number Generator. SIAM Journal on Computing, 1986, 15 (2), 364–38310.1137/0215025Search in Google Scholar

[2] Woźniak M., Połap D., On some aspects of genetic and evolutionary methods for optimization purposes, Int. J. Electron. Telecommun, 2015, 61(1), 7–1610.1515/eletel-2015-0001Search in Google Scholar

[3] Słota D., Using genetic algorithms for the determination of an heat transfer coefficient in three-phase inverse Stefan problem, Int. Commun. Heat Mass Transf., 2008, 35(2), 149–15610.1016/j.icheatmasstransfer.2007.08.010Search in Google Scholar

[4] Devroye L., Non-Uniform Random Variate Generation, Springer, 198610.1007/978-1-4613-8643-8Search in Google Scholar

[5] Hörmann W., Leydold J., Derflinger G., Automatic Nonuniform Random Variate Generation, Springer-Verlag, Berlin Heidelberg, 200410.1007/978-3-662-05946-3Search in Google Scholar

[6] Box G.E.P., Muller M.E, A Note on the Generation of Random Normal Deviates, Ann. Math. Stat., 1958, 29(2), 610–61110.1214/aoms/1177706645Search in Google Scholar

[7] Marsaglia G., Bray T.A., A convenient method for generating normal variables, SIAM Rev., 1964, 6, 260–26410.1137/1006063Search in Google Scholar

[8] Leva J.L., A fast normal random number generator, ACM T. Math. Softw., 1992, 18, 449–45310.1145/138351.138364Search in Google Scholar

[9] Afflerbach L., Wenzel K., Algorithm Normal random numbers lying on spirals and clubs, Stat. Pap., 1998, 29, 237–24410.1007/BF02924529Search in Google Scholar

[10] Pingel D., Schmelcher P., Diakonos F.K., Theory and examples of the inverse Frobenius–Perron problem for complete chaotic maps, Chaos, 1999, 9(2), 357–36610.1063/1.166413Search in Google Scholar

[11] Koga S., The Inverse Problem of Flobenius-Perron Equations in 1D Difference Systems: 1D Map Idealization, Prog. Theory. Phys., 1991, 86(5), 991–100210.1143/ptp/86.5.991Search in Google Scholar

[12] Grossmann S., Thomae S., Invariant Distributions and Stationary Correlation Functions of One-Dimensional Discrete Processes, Z. Naturforsch, 1977, 32, 1353–136310.1515/zna-1977-1204Search in Google Scholar

[13] Lai D., Chen G., Generating Different Statistical Distributions By The Chaotic Skew Tent Map, Int. J. Bifurcat. Chaos, 2000, 10, 1509–151210.1142/S0218127400000955Search in Google Scholar

[14] Palacios-Luengas L., Delgado-Gutiérrez G., Díaz-Méndez J.A., et al., Symmetric cryptosystem based on skew tent map, Multimed Tools Appl, 2017, 1–3210.1007/s11042-017-4375-9Search in Google Scholar

[15] Li C., Luo G., Qin K., Li C., An image encryption scheme based on chaotic tent map, Nonlinear Dynamics, 2017, 87(1), 127–13310.1007/s11071-016-3030-8Search in Google Scholar

[16] Khan J., Ahmad J., Hwang S.O., An efficient image encryption scheme based on: Henon map, skew tent map and S-Box, In: 6th International Conference on Modeling, Simulation, and Applied Optimization (ICMSAO) (27-29 May 2015 Istanbul, Turkey), 2015, 1–610.1109/ICMSAO.2015.7152261Search in Google Scholar

[17] Lawnik M., Analysis of the chaotic maps generating different statistical distributions, J. Phys.: Conf. Ser., 2015, 633(012086), 1–410.1088/1742-6596/633/1/012086Search in Google Scholar

[18] Berezowski M., Lawnik M., Identification of fast-changing signals by means of adaptive chaotic transformations, Nonlinear Anal. Model. Control, 2014, 19(2), 172–17710.15388/NA.2014.2.2Search in Google Scholar

[19] Lawnik M., The approximation of the normal distribution by means of chaotic expression, J. Phys.: Conf. Ser., 2014, 490(012072), 1–410.1088/1742-6596/490/1/012072Search in Google Scholar

[20] Lawnik M., Generation of numbers with the distribution close to uniform with the use of chaotic maps, In: Obaidat M.S., Kacprzyk J., Ören T. (Ed.), International Conference on Simulation and Modeling Methodologies, Technologies and Applications (SIMULTECH) (28-30 August 2014, Vienna, Austria), SCITEPRESS, 2014, 451–45510.5220/0005090304510455Search in Google Scholar

[21] Huang W., Characterizing chaotic processes that generate uniform invariant density, Chaos, Soliton Fract., 2005, 25(2), 449–46010.1016/j.chaos.2004.11.016Search in Google Scholar

[22] Anikin V.M., Arkadaksky S.S., Kuptsov S.S., Remizov A.S., Vasilenko L.P., Lyapunov exponent for chaotic 1D maps with uniform invariant distribution, B. Russ. Aca. Sci. Phys., 2008, 72(12), 1684–168810.3103/S106287380812023XSearch in Google Scholar

[23] Python scipy.stats module, (last access 23.03.2016)Search in Google Scholar

**Received:**2016-10-29

**Accepted:**2017-12-22

**Published Online:**2018-02-08

© 2018 Lawnik, published by De Gruyter

This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License.