Студопедия  
Главная страница | Контакты | Случайная страница

АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатика
ИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханика
ОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторика
СоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансы
ХимияЧерчениеЭкологияЭкономикаЭлектроника

Generation of random numbers

Methods of generation of random numbers share on two classes: the casual arithmetic numbers generated by the computer; the casual physical numbers generated by a phenomenon, such as radioactive substances and space beams.

The casual arithmetic number is defined as some not casual number in a series of strict sequence with extremely long period of repetition. Thus, they are the pseudo-random numbers which randomness should be supervised.

The casual physical number is generated, for example, with use scale of the beams radiating sequence of clicks with Poisson distribution of intervals of time between disintegrations радионуклидов. Because of difficulty of generation of casual statistically identical numbers, however, it is not suitable for imitations of the traffic which demands regular realisations.

Demanded conditions for generation of pseudo-random numbers:

1) Any numbers can be generated many;

2) Sufficient randomness of sample of the numbers, reached in the necessary length of the period of repetition;

3) Statistically any identical numbers can repeatedly be generated;

4) The statistical characteristic answers the imitating purposes.

As homogeneous random number is called any number in regular intervals distributed in the set range. Typical methods of generation of homogeneous random numbers are: a method of an average square, multiplicate конгруэнтный (multicoherent) method mixed конгруэнтный (equal and similar) a method and the M-sequence method.

The method of an average square has been entered a background by Neumann. According to a method any n-digit number undertakes and is designated x0. The number square x0 contains 2n signs from which it is chosen from the middle new n-digit number and is designated it x1. Repeating similar operations, we will receive a series of random numbers: x0, x1, x2, …. For example, at n = 2 formula.

As the given method has rather short repeating period it for reception of a long series of random numbers is not used.

The multiply method allows to generate a series of random numbers x0, x1, x2, …, received by calculation of iterative expression: formula (60)

Where (mod M) - represents the rest on the M module at division of number into M.

It is known that the maximum of the period of repetition 2b-2 is reached at k = ±3 (mod 8), x0 = 1 (mod 2) and M = 2b.

Mixed конгруэнтный the method allows to generate a series of random numbers x0, x1, x2, …, received by calculation of iterative expression: formula 61)

The maximum of the period of repetition 2b is reached at k = ±3 (mod 8), x0 = 1 (mod 2) and M = 2b.

The M-sequence method allows to generate a series of random numbers x0, x1, x2, …, received by calculation of following expression: formula (62)

Where c1, c2, …, ck - 1 = 0 or 1, and ck = 1, a period maximum 2k - 1.

Carrying out binary transformations of decimal sequence l (£ k) the numbers taken from a series {xj}, make random numbers with uniform distribution in an interval (0, 1). The given method demands a quantity of repeated operations for random number reception as only one binary number can be generated on calculation. Though it seems unprofitable from the point of view of speed but as operation on the module 2 is equivalent to logic operation «excluding OR» random number generation can be accelerated parallel execution of logic operation.

Any random numbers often are required at imitations. Unfortunately, however, the universal method which gives the algorithm providing the program for set function of distribution is not developed yet. To typical methods of generation of any random numbers carry a method of inverse transformations, a method of negation and a composition method.

The method of inverse transformations uses some algorithm for generation of the random numbers following some function of distribution F (×) for which there is inverse function F - 1 (×). The principle of this method is shown on fig. 18.

Having put that Y there is the casual variable corresponding to uniform distribution in an interval (0, 1), we will receive formula (63)

Let's generate homogeneous random number Y a method described above, and we will put formula (64)

Then X corresponds to function of distribution F (x). Of it make sure from a parity: formula (65)

The negation method is applied to distributions for which density function f (x) is limited by some contour. Let A will be area between y = f (x) and an axis x. Then the co-ordinate x any template taken from area A, becomes a random number following for f (x).

Let g (x) will be function which is more than or it is equal f (x), and we will assume that the casual variable is generated as formula (66)

Where C = - planimetric integral.

Any number following for f (x), is generated according to algorithm:

a) Random numbers X and Y, following for (x) and U (0, 1), accordingly are generated;

b) If Y> f (X) / g (X) we come back to point (); otherwise X is required any number.

The name of the given method has come from that fact that X is denied until a point belonging to area A, tried. К.п.д. This method for generation of any numbers depends on following factors:

c) Average (C - 1) negations to receive any number;

d) Speeds of generation of any number following for (x);

e) Computing process from f (X) / g (X).

In order to improve kW efficiency the choice of suitable function g (×) is more important, and also the point () has still considerable influence. If density function does not appear, the suitable image of function of density find by variable transformation, and then the negation method to outline function can be applied.

The composition method is applied to distributions where the probability of function of density f (x) is expressed in the form of integral with members of type f (x, q) and g (q) as formula (67)

If we generate the first any number q 0, following for g (q), and other any number x0, following for f (x, q) becomes clear that x0 follows for f (x). In practice if g (q) it is discrete, record of probability of function of density as is very often used formula (68)

If we use concerning the big weight rk, corresponding to function fk (x) some any number following it is easily generated (for example, uniform distribution) and demanded any number can be generated productively.

 




Дата добавления: 2015-02-16; просмотров: 62 | Поможем написать вашу работу | Нарушение авторских прав




lektsii.net - Лекции.Нет - 2014-2025 год. (0.009 сек.) Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав