Designing the Uniform Stochastic Photomatrix Therapeutic Systems

Photomatrix therapeutic systems (PMTS) are widely used for the tasks of preventive, stimulating and rehabilitation medicine. They consist of low-intensity light-emitting diodes (LEDs) having the quasi-monochromatic irradiation properties. Depending on the LED matrix structures, PMTS are intended to be used for local and large areas of bio-objects. However, in the case of non-uniform irradiation of biological tissues, there is a risk of an inadequate physiological response to this type of exposure. The proposed approach considers a novel technique for designing this type of biomedical technical systems, which use the capabilities of stochastic algorithms for LED switching. As a result, the use of stochastic photomatrix systems based on the technology of uniform twisting generation of random variables significantly expands the possibilities of their medical application.


Introduction
The photomatrix therapeutic system (PMTS), in its generalized form, is a net of light-emitting diode (LED) irradiation sources on a dimensional plane, and the LEDs themselves are located in the nodes of this grid, which in turn is fixed by the given spatial dimensions [1][2][3][4][5][6]. The issues of designing PMTS medical devices have already been described, making it possible to combine three principal aspects: illumination and optical characteristics of LEDs, their spatial and geometric arrangement on the surface of matrix substrate, and also the parameters of photobiological influence on the body in the context of the given biomedical requirements [7][8][9][10][11][12][13].
Superbright LEDs possess quasi-monochromatic properties, i.e., relatively narrow spectral width of the irradiation range-up to several nanometers, depending on the central wavelength of the light source [14][15][16][17][18][19][20]. In certain medical tasks they could be considered as point laser sources, comparable with small laser diodes. Although the emission of LEDs does not satisfy such basic properties as coherence and polarization, which are inherent in laser irradiation, a huge amount of biomedical data indicate a close similarity between these two types of light sources. This is mainly due to the fact that when irradiating the skin of a biological object, the unique laser properties are largely leveled, starting from a depth at around three hundred microns from the skin surface [1,3,4,[14][15][16][17][18].
In modern medical practice, phototherapy methods, including those based on superbright LEDs, have taken a strong place among the techniques of system-wide exposure to the human body [19][20][21][22][23][24]. In general, the basic principle of photobiological exposure is that a pronounced photoactivation [19][20][21][22][23][24]. In general, the basic principle of photobiological exposure is that a pronounced photoactivation occurs at the molecular, cellular, tissue, organ, and systemic levels in the bio-object.
The main effects of phototherapy should be considered a systemic improvement in metabolism, as well as the normalization of blood flow components, for example, blood viscosity, microcirculation and rheology parameters, immunologic responses, and secondary regenerative processes, among others [21][22][23][24][25][26][27]. As a result, expressed therapeutic effects are achieved, such as biostimulatory, anti-inflammatory, analgesic, and decongestant effects, and many others.
Several typical medical PMTS are presented in Figure 1. In particular, Figure 1A shows a cylindrical apparatus for photomatrix action on extremities of hands and feet, and Figure 1B presents a semicylindrical apparatus for the integral irradiation of extended skin surfaces, such as the abdomen or back. In addition to devices for the LED exposure alone, there are also combinations with other various sources of low-intensity physiotherapy. In particular, Figure 1C shows an apparatus that combines both LED irradiation and negative low-intensity pressure for the treatment of copulative dysfunction; Figure 1D displays a photo-ultrasound tool for treating the infected and purulent-necrotic wounds, which consists of a spherical segment of PMTS and a low-frequency ultrasonic waveguide; Figure 1E demonstrates a device combining LEDs of various wavelengths and a low-intensity magnetic field to affect various systems of the human body, for example, nervous, circulatory, musculoskeletal, etc., in order to enhance metabolic processes. In addition to the rigid frames in which the LEDs are fixed, there are also many PMTS based on flexible substrates, which provide a more accurate correspondence to the reliefs of biological tissues. Therefore, Figure  1F presents a semi-flexible construction of PMTS designed for various medical tasks based on LED phototherapy. In general, over thirty different types of PMTS are presently available on the market or known as laboratory prototypes. The following operating modes of PMTS have been demonstrated [1][2][3][4][5][6][7][8][9][10][11][12][13]: constant, when all LEDs are on, but no modulation of irradiation is performed; blinking, where the LED sources are switched on at a specified frequency; blinking with pulse rate biosynchronization (based on pulse oximetry using a fingertip), in this case, the emission intensity of all LEDs is directly proportional to the volume of arterial blood supplying the vessels; looped modes of sequential single activation of each source or all LEDs lying on the same coordinate line; a variety of schematic modes such as 'treadmill' or specially designed modifiable 'patterns'; modes of sequential or predetermined changes in the wavelengths of the LED irradiation (in the case of tunable sources); various stochastic modes for turning on the LEDs that are controlled using a connected random number generator; and others.
However, the stochastic modes for PMTS operation have not been sufficiently explored at present. Moreover, absolutely all known pseudo-random number generators, which are also used for biomedical technical systems, have a varying degree of uneven generation. In the case of PMTS, this means non-uniform generation of turning on the irradiation sources, i.e., the LEDs. This, in turn, can lead to some inadequate physiological responses of the body, at least at the biotissue level.
Moreover, in a worst-case scenario, such a non-uniform distribution of the modulation of the LED sources operation could be the reason for unpredictable reactions of the body. As a result, instead of low-intensity light stimulation, the physiological answer of the biological object may lead to unforeseen actions after such an unbalanced integral influence. In other words, an irregularly illuminated organism, i.e., somewhere unirradiated at all, and somewhere irradiated unnecessarily, can erroneously cause the compensatory mechanisms of patient's biosystems.
Thus, the goal of this article is the study and creation of uniform stochastic modes for LED phototherapy that satisfy the conditions of uniform twister generation of light by point LED sources located on the PMTS surface.

Theory
The main advantage of the PMTS in comparison with other optical sources is the provision of the required irradiation intensity over the entire area of a sufficiently extended biological surface. However, as such, the spatial irradiation of a bio-object by a certain group of LEDs cannot be considered uniform if the LED sources are not located on the PMTS substrate in accordance with a strictly specified calculated location. Without this, irradiation of the body surface at different points of the biological object will occur with different and uncontrolled intensities.
Many scientific methods have been proposed in the research articles on the issue of ensuring the uniform irradiation of an extended object using a group of LED sources or LED matrices [28][29][30][31][32][33]. It should be noted that one of the promising modern areas in this field is the development of various lens solutions for LED systems [34][35][36][37]. However, despite this, the task of uniform irradiating using various LED schematics is still more than relevant.
Thus, let us initially consider here the theoretical aspects of the mathematical and engineering calculations of LED matrices, which allow designing the PMTS satisfying the properties of the spatial uniformity of the irradiation intensity over the entire surface of the body. In accordance with this, the geometrical dimensions and relief parameters of the biotissue as a basis determine the spatial formation of the PMTS substrate. The main parameters of the typical LED used in PMTS are the following: -wavelength of LED irradiation at maximum λ, nm; -half-width of irradiation spectrum ∆λ, nm; -luminous intensity at given current through LED, mcd; -double aperture angle 2α 0 , deg; -general voltage and current characteristics; -dependence of the luminous intensity on the direct current through LED; -maximum permissible electrical features of LED; -physical dimensions for particular LED and total amount of them; Algorithms 2020, 13, 41 4 of 21 -general geometrical sizes of PMTS and shape of matrix surface.
In the current case, particular for our tasks of biomedical application of PMTS, the following assumptions could be made: -LED irradiation is quasi-monochromatic; -each LED is considered to be a point source radiating within the dimensional aperture angle; -the wavelength of the LED irradiation belongs to visible and near-infrared ranges; -the optical axis of LED is normal to the inner surface of PMTS and to irradiated biotissue. Now, let us determine the illuminance produced by a single LED. Consider orthogonal coordinates with LED at the origin of coordinates and Z-axis coinciding with the optical axis of the LED (i.e., the axis of the diode lens) (Figure 2). In the current case, particular for our tasks of biomedical application of PMTS, the following assumptions could be made: each LED is considered to be a point source radiating within the dimensional aperture angle; -the wavelength of the LED irradiation belongs to visible and near-infrared ranges; -the optical axis of LED is normal to the inner surface of PMTS and to irradiated biotissue. Now, let us determine the illuminance produced by a single LED. Consider orthogonal coordinates with LED at the origin of coordinates and Z-axis coinciding with the optical axis of the LED (i.e., the axis of the diode lens) ( Figure 2). In this case, the illuminance at some physical point , , of the irradiated surface is determined by the following equation: where is derived from: and angle is determined by: Therefore, in the aforementioned equations, the key parameter ( ) is the luminous intensity of the single LED, then is the angle between the direction of irradiation and the optical axis of the LED, and is the angle between the direction of irradiation and the normal to the biological surface at a given point.
Equations for the angle depend on the frame shape of PMTS and the irradiated biotissue. Let us indicate here some typical cases of this interrelation:   In this case, the illuminance at some physical point (x 0 , y 0, z 0 ) of the irradiated surface is determined by the following equation: where r 2 0 is derived from: and angle α is determined by: Therefore, in the aforementioned equations, the key parameter J(α) is the luminous intensity of the single LED, then α is the angle between the direction of irradiation and the optical axis of the LED, and β is the angle between the direction of irradiation and the normal to the biological surface at a given point.
Equations for the angle β depend on the frame shape of PMTS and the irradiated biotissue. Let us indicate here some typical cases of this interrelation: For the first case mentioned above, angle β is equal to angle α, and so it is calculated as follows: For the 2nd and 5th cases, the realization of angle β is in the following form: where r 1 and r 2 are derived from these equations: In this case, for some spatial point Q, its coordinate reference will be determined by the expressions x Q = x 0 , and then z Q = 0, and y Q will look as follows: where the term c corresponds to the designation of the cylinder; if z 0 = z c , then in this case z Q = z 0 and y Q = y 0 + r c . For the 3rd, 6th and 8th cases, the realization of angle β is based on the same Formulas (5), (6) and (7); however, for some spatial point Q its coordinate reference will be determined by other expressions: z Q = 0, then y Q by Formula (8), and x Q will look as follows: If z 0 = z c , then in this case, z Q = z 0 and x Q = x 0 + r s , where the term s corresponds to the designation of the sphere; next, if x 0 = x c , then in this case x Q = x 0 and y Q = y 0 + r s .
For the 4th case, the determination of angle β will take the following form: where ϕ is the angle between the Z-axis and the optical axis of the LED. For the 8th case the determination of angle β will look almost the same as the previous one; however, because of the spherical surface, the addition of the iteration step i is required: In the simplest case, the luminous intensity of the single LED J(α) has the following form of dependence: Algorithms 2020, 13, 41

of 21
To calculate the illuminance resulting from a flat LED matrix, for example, at a point K lying on the optical axis of one of the diode sources, the following equation could be used: where 2d is the distance between the adjacent LED point sources, and l o is derived trigonometrically as l 0 = 2d· cos α 0 ( Figure 3).
Algorithms 2020, 13, x FOR PEER REVIEW 6 of 21 The first term of Series (13) describes the LED irradiation nearest to the point K. As the distance from the irradiating surface increases, new terms occur in the series due to obvious overlapping of light beams. This equation shows that theoretical determination of illuminance at an arbitrary point requires complicated calculations and unjustified simplifications. It is more appropriate to determine the LED light distribution over a surface of a certain type generated by one of the aforementioned types of PMTS or combinations of them. Also, it is better to assume that the shape of the irradiated biotissue can be approximated with a flat, cylindrical, or spherical surface. As a result, due to such assumptions, the general task of calculating the LED intensity created by the matrix structure can be divided into several special cases.
The illuminance at each point of the irradiated surface is calculated as the summarization of illuminances produced by each LED. In the process of calculation of the contribution of each LED the coordinate system is translated so that the origin of coordinates coincides with the LED under consideration, whereas the Z-axis is directed along the optical axis of the diode source (in the direction of light distribution). Thus, if coordinates ( , , ) of the point K in the new coordinate system are determined, then the illuminance is calculated using Formulas (1), (2) and (3). Such a basic coordinate system was selected to simplify the specification of parameters of the irradiated surface. Now, based on all of the aforementioned assumptions, let us consider several main methods of illuminance calculation produced by PMTS of various types.
Flat PMTS (Figure 4, left). For the flat type of PMTS the calculation begins from the upper left LED. In this case, the coordinates of the irradiated point are: where dx and dy are the distances between adjacent LEDs along the X-and Y-axes of the basic coordinate system, respectively; Nx and Ny represent the numbers of LEDs along these axes.  The first term of Series (13) describes the LED irradiation nearest to the point K. As the distance from the irradiating surface increases, new terms occur in the series due to obvious overlapping of light beams. This equation shows that theoretical determination of illuminance at an arbitrary point requires complicated calculations and unjustified simplifications. It is more appropriate to determine the LED light distribution over a surface of a certain type generated by one of the aforementioned types of PMTS or combinations of them. Also, it is better to assume that the shape of the irradiated biotissue can be approximated with a flat, cylindrical, or spherical surface. As a result, due to such assumptions, the general task of calculating the LED intensity created by the matrix structure can be divided into several special cases.
The illuminance at each point of the irradiated surface is calculated as the summarization of illuminances produced by each LED. In the process of calculation of the contribution of each LED the coordinate system is translated so that the origin of coordinates coincides with the LED under consideration, whereas the Z-axis is directed along the optical axis of the diode source (in the direction of light distribution). Thus, if coordinates (x 0 , y 0 , z 0 ) of the point K in the new coordinate system are determined, then the illuminance is calculated using Formulas (1), (2) and (3). Such a basic coordinate system was selected to simplify the specification of parameters of the irradiated surface. Now, based on all of the aforementioned assumptions, let us consider several main methods of illuminance calculation produced by PMTS of various types.
Flat PMTS (Figure 4, left). For the flat type of PMTS the calculation begins from the upper left LED. In this case, the coordinates of the irradiated point are: where dx and dy are the distances between adjacent LEDs along the Xand Y-axes of the basic coordinate system, respectively; N x and N y represent the numbers of LEDs along these axes. LED. In this case, the coordinates of the irradiated point are: where dx and dy are the distances between adjacent LEDs along the X-and Y-axes of the basic coordinate system, respectively; Nx and Ny represent the numbers of LEDs along these axes. The illuminance is calculated sequentially for LED rows parallel to the X-axis. As the coordinate system is translated along the X-axis, the coordinates are transformed as follows: Furthermore, as the coordinate system is translated along the Y-axis, the following transformation of coordinates is used as well: Cylindrical PMTS (Figure 4, center; Figure 5). Prior to the calculations of the cylindrical type of PMTS, the following parameters have to be specified: quantities N g and N a of LEDs along the generating line and the arc of the cylinder, respectively; distance dx c between adjacent LEDs along the generating line; angle γ between adjacent LEDs lying on the same arc; PMTS cylindrical radius R c . At the beginning of the calculation, the coordinates of the irradiated point are: where the angle µ for a non-closed cylinder is determined by the following equation: For a completed cylinder of PMTS the angle µ = 0 if there are diode sources on the X-axis of the basic coordinate system; if there are no LEDs, then µ = γ/2.
The illuminance is calculated sequentially for LED rows parallel to the X-axis. As the coordinate system is translated along the X-axis, the coordinates are transformed as follows: Furthermore, as the coordinate system is translated along the Y-axis, the following transformation of coordinates is used as well: where the angle for a non-closed cylinder is determined by the following equation: For a completed cylinder of PMTS the angle = 0 if there are diode sources on the X-axis of the basic coordinate system; if there are no LEDs, then = /2. The illuminance is calculated sequentially for LED rows parallel to the generating line. As the coordinate system is translated along the generating line, the coordinates are transformed as follows: In the next iteration, as the coordinate system is translated along the arc, the following transformation of coordinates is used: Spherical PMTS (Figure 4, right; Figure 6). This type of PMTS substrate is the most complex of all three cases, since its calculation depends on many related variables. The following parameters should be assigned for the spherical PMTS: radius R s of the sphere; number N p of parallel circles constituted by LEDs (a single diode source lying in the origin of coordinates); angle ξ between parallel circles; angle θ i between adjacent LEDs on the i-th parallel circle (θ i = 2π/N i , where N i is the number of LEDs on the i-th parallel circle); angular displacement ψ i between i-th and previous parallel circles, accordingly.  In the calculation of illuminance produced by a spherical PMTS, the coordinate system is translated in the following manner: first, the illuminance produced by the LED lying in the origin of the basic coordinate system is determined. Then, the coordinate system is translated to the first parallel circle and rotated by an angle ; then it is translated to the second parallel circle and rotated by an angle (it is assumed that = 0.); then by an angle , and so on. Thus, the total illuminance will be obtained. As the coordinate system is translated from one parallel circle to another, the following transformation of coordinates is used: , = , , = , cos − , sin − sin , = , sin + , cos + (1 − cos ) Translation of the coordinate system along each parallel circle is performed clockwise when looking in the direction opposite to the Z-axis of the basic coordinates. The following alteration is used for translating the coordinate system along a parallel circle: where is the angle between the axes , and , ; is the angle between the axes , and .
; sin , cos , sin , and cos are determined trigonometrically: In the calculation of illuminance produced by a spherical PMTS, the coordinate system is translated in the following manner: first, the illuminance produced by the LED lying in the origin of the basic coordinate system is determined. Then, the coordinate system is translated to the first parallel circle and rotated by an angle θ i ; then it is translated to the second parallel circle and rotated by an angle ψ 2 (it is assumed that ψ 1 = 0); then by an angle θ 2 , and so on. Thus, the total illuminance will be obtained. As the coordinate system is translated from one parallel circle to another, the following transformation of coordinates is used: Translation of the coordinate system along each parallel circle is performed clockwise when looking in the direction opposite to the Z-axis of the basic coordinates. The following alteration is used for translating the coordinate system along a parallel circle: where ϕ 1 is the angle between the axes Z i,j and Z i,j+1 ; ϕ 2 is the angle between the axes Y i,j and Y i.j+1 ; sin ϕ 1 , cos ϕ 1 , sin ϕ 2 , and cos ϕ 2 are determined trigonometrically: Next, after all the aforementioned assignments, it is time to introduce the rotation matrices used for calculation when transferring the coordinate system. These are determined by the following mathematical forms: In the case when in these matrices i·ξ = 90 • , then the original Expression (22) used to move the coordinate system can be represented as the following transformation: Thus, after transitions to the i-th parallel circle from the previous one the first step is the moving along with an angular displacement ψ i between those parallels, and only after that will one by one calculation take place for the value of angle θ i between adjacent LEDs of spherical PMTS.
As a result, using the sequential transformations described above, the illuminance of the biotissues can be calculated for three main types of PMTS. At the same time, more complicated biological surfaces may be considered as a combination for these three PMTS types, and so the illuminance in this case can be calculated as well.
As noted at the beginning of this section, one of the main advantages of the PMTS over all other light sources is the integral spatial irradiation of extended biological surfaces having any skin relief. The methodology proposed above makes it possible to create a PMTS in which the LED sources are not located unsystematically or by chance, but in a certain order in accordance with the mathematical and engineering calculation algorithm. Thus, by strictly following the spatial mathematical model for calculating the placement of each LED, it will be possible to create such PMTS that will completely satisfy the properties of absolute uniform irradiation of the body surface with the same intensity over the entire irradiated area.
Furthermore, it should be emphasized that the algorithm proposed above describes how to create uniform spatial illuminance, which is true for a constant mode of the LED irradiation. However, this mode of PMTS operation is only the initial basic mode; all other regimes that were indicated in the Introduction section of this article are pulse-generated. The most complex of them is the stochastic mode, the implementation of which is not a trivial task, and thus has still not been fully solved in LED phototherapy. The questions regarding this issue are considered in the next sections.

Features of Standard Programmable Tools
Usually, the control of complex modes of switching on LED elements is carried out using microcontrollers [1,14,17,18]. At the same time, the microcontroller itself is supplemented with special technical tools, i.e., it is almost an analogue of a computer, but with limited and specific capabilities. The assigned functioning of the microcontroller is determined by the internal software, which forms the irradiation modes of the LEDs both in time and in intensity. One of the popular programming languages for modern microcontrollers is the classical C language in different dialects.
Let us start from the question of uniform randomness, which is an important special case of the general concept of stochastic phenomena in probability theory, mathematical statistics and the theory of random processes [38][39][40][41][42][43][44][45]. Particularly for the current issue, i.e., in case of PMTS influence on biological tissue, this means an accurate understanding of the uniform operation of randomly turned on LEDs. The term 'uniform random variables' means that in the allotted time, all the exposure elements (LEDs or their analogues) are switched on precisely the same number of times [46][47][48][49][50][51]. Thus, it should be started with this, i.e., by checking the ability of standard tools to ensure the uniform generation of irradiation from point light sources.
The matrix of the Descartes plane U × V contains N u cells along the U orthogonal axis and N v cells along the V one. Thus, the matrix contains M = N U ·N V cells in total; in each of them, only one LED is located. The case of the arrangement of several point sources of light in one cell will not be considered here, since it is almost additively reduced to single-point emitters in the mathematical sense. Therefore, let us take as a basis the fact that, physically, the matrix accommodates M elements of LEDs located on a two-dimensional plane.
Furthermore, let us pay attention to an elementary but complete period of time, during which all LEDs must be turned on in a random sequence. The illuminance time of one LED is designated as τ. Therefore, the time interval T M of the full glow of all the LEDs in the matrix is T M = τ·M. The minimum completeness of activation of the emitters means that they all turn on exactly once. In accordance with this, the potentials of coordinates u, v ∈ U × V assigned with the number of LEDs to be switched on and calculated from these coordinates are independently provided along the grid of LEDs. These coordinates uniquely correspond to the coordinates of the matrix cells u, v ∈ M. Random enumeration of these cells is a mathematical model of a stochastic emitting process by LED.
Based on principles described above, the following issue needs to be considered for the current task. Could the uncontrolled independent modeling of coordinates u, v be accepted as a sufficient condition for the construction of LED matrices? We will demonstrate that such a technology produces poor quality results; after that, we will also show and discuss the proposed option in which the result of absolutely uniform distribution of the LED irradiation can be obtained. Therefore, to find the answer to this question, let us take the standard function Random (), which comes as a generator of random variables together with other tools of C language. As an example, let us take the matrix plane having a size of U × V = 8 × 8 cells, which accordingly consists of 64 LEDs. In reality, the number of cells can reach several hundred or even more. To demonstrate the result of the simulation, the code DMP0101 in C# dialect of Microsoft Visual Studio is given below. The output of the printed sequences created by generator GU from the above program shows that starting from the first generation, the sequence string U = { 5 0 2 3 2 1 6 4 } demonstrates the repetition of random variable 2. This simple example indicates that frequencies of the matrix cells are not uniform, since some cells are activated several times. Specifically, in this case, one of the variables appears with a frequency of more than one. Thus, the analysis of the printout demonstrates that the standard generator Random () does not provide the proper quality of uniform stochastic activation of the LED sources of PMTS.
Currently, there are many generators available for the generation of variables, and all of them have different degrees of uniformity. For example, generator Random () demonstrates a level of uniformity which does not exceed 30%. This means that on the assigned diapason of variables, only 30% of them are distributed uniformly without repeated or skipped elements. Another well-known Mersenne twister generator MT19937 [52] shows a fairly high degree of uniformity, which is about 70%. At the same time, the twister generator nsDeonYuliTwist32D [48] has absolute complete uniformity in the range 0 : 2 w − 1 of random variables with w bit length.
Let us further test the generator nsDeonYuliTwist32D for its applicability for the construction of stochastic PMTS. It fully satisfies the properties of non-repeating and non-skipping of the generated elements. Below is the program code DMP0102 for the independent testing of generation quality, which is especially designed for the aforementioned task. The idea of this program fully coincides with the code DMP0101, but the realization is implemented using the complete uniform twister generator nsDeonYuliTwist32D instead of the standard Random () one. Let us emphasize here once again that generator Random () a priori cannot create sequences without the repetition or skipping of the elements. This is tantamount to a switched off state or a set of repeated switched LEDs on conditions. A direct check of the sequences U and V in each iteration over the index i shows their absolutely complete uniformity, i.e., sequences do not have skipping or repetition of random variables. However, the presence in matrix A of cells with values different from the number 1 means that the independent generation of the coordinates of random points u, v on a plane does not provide a uniform distribution of these points on a grid of the discrete plane. Some points are absent altogether (values 0), others are present several times (values > 1). Therefore, following only the property of independent complete uniform generation of the coordinates of the matrix cells is not sufficient for the formation of uniform stochastic PMTS.

Features of Designing the Stochastic Programmable Tools
In the previous subsection, it was found that to create a uniform random plane, the independent generation of random variables along the axes of the Descartes coordinates in the photomatrix is not sufficient. In this case, the effect of an algorithmic dependence of the generated sequences of random variables may occur. Thus, let us indicate below the concept of a random plane.
Usually, in analytical geometry, a random arrangement of a plane in three-dimensional space is understood to mean a variation of its equation Ax + By + Cz + D = 0 with respect to the coefficients A, B, C and D. However, this definition is suitable only for the geometric arrangement of the plane [53][54][55][56][57][58][59], and such an approach is not enough for the complete characterization of stochastic planes. The reason for this is that in such a generalized geometric definition there is no main Descartes characteristic of the plane, which is due to the fact that two of its properties have to be provided on a discrete uniform plane: the discrete grid of the Descartes plane must contain all points in its nodes; -each point is unique and represented once only.
Next, the Descartes plane could be labeled as stochastic if a topological (meaning logically connected) transition from one point to another can be performed randomly. In [49] the generator nsDeonYuliPlaneTwist32D was introduced to create all the stochastic uniform sequences without skipping or repeating the elements. All cells of the grid are taken into account, and the aforementioned property is fully satisfied. Figure 7 shows how the possible transitions between points along a stochastic path are performed. It should be noted that Figure 7 demonstrates only one of the possible ways to implement the transition process, although in reality they may reach over several thousand.
As an example, in the program code DMP0103, it is shown how to organize and create such a generation for a square photomatrix with a size of N × N = 8 × 8 cells. Such a small range is selected only for visual presentation in this article, but for the real task the range of construction N × N could be chosen for any size.  1 1 1 1 1 1 1  1 1 1 1 1 1 1 1  1 1 1 1 1 1 1 1  1 1 1 1 1 1 1 1  1 1 1 1 1 1 1 1  1 1 1 1 1 1 1 1  1 1 1 1 1 1 1 1  1 1 1 1 1 1 1 1 This printout confirms that in matrix A each point source of cell grid (or LED, in the context of PMTS construction) is randomly turned on exactly once, ensuring the property of uniformity over the entire plane. It is necessary to obtain exactly this result for software applications that target the stochastic design of PMTS. In our case we have just achieved it.

Discussion
The above proposed and analyzed algorithm for the stochastic switching on the LED sources uses twisting sequences U and V. The generation begins with a congruent sequence in which the next random variable x i is calculated from the value of the previous random variable x i−1 as follows: The mathematical operation modulus forms the remainder of integer division of f (x i−1 )/N. This allows for keeping the values of random variables x i−1 and x i in the interval [0 : N]. There is no skipping of numbers in uniform sequences, and none of them are repeated. Thus, the uniform sequence of numbers from the interval x ∈ 0 : N − 1 contains exactly N numbers. Therefore, operation mod N in Expression (1) coincides with the length N of the stochastic sequence.
In Expression (26) the form of the function can be taken arbitrarily. The most common option for this realization is a linear function in the following form: Substituting (27) into (26), it is possible to obtain a congruent linear dependence of the sequential generation of random variables: Formally, congruent generation (28) could not be considered as an absolutely complete probabilistic space [46], since in the field of congruent sequences, using Gödel's theorem on the arithmetic incompleteness of factorial transformations, it is impossible to completely create all the stochastic sequences. In such cases, pseudorandom variables are usually referred to. However, in practical implementation, for example in our case of the stochastic PMTS designing, an absolutely complete probabilistic space, which is inherent in theoretical problems, is not required. Specifically, in our case, this follows from the fact that irradiation interval by LED source has a limited time period τ, which in turn provides a total finite time of full exposure in form as T = τ· (N × N).
Thus, the physical time restrictions on the switching on and off the LEDs, taking into account the effectiveness of the impact on the biological tissue of the human body, do not allow theoretical stochastic implementation over complete probabilistic space. In other words, PMTS in reality is able to perform only a limited probabilistic realization of the stochastic process. This is sufficient for practical implementation to reliably describe a probabilistic (or partial in the number of probabilistic options, i.e., pseudo-probabilistic) random plane.
Moving further, it could be be noted that Expression (28) also has some limitations. The first of which concerns the number N. Our mathematical studies [46][47][48][49][50][51] show that uniform generation is achieved only at the condition of N = 2 w . The exponent w exactly matches the quantity of the required binary bits, which are needed for representing the decimal number N − 1. These w bits contain N = 2 w gradations of representations of all numbers from the interval 0 : N − 1 = 0 : 2 w − 1 .
The second restriction relates to the multiplicative constant a in Expression (28). First of all, constant a must not be outside the range of random variables a ∈ 0 : 2 w − 1 . The uniform sequences consisting of N random variables are possible only when the following condition is satisfied: The third issue concerns the additive constant c in Expression (28). There is the same requirement for constant c, i.e., it must not be outside the range of random variables c ∈ 0 : 2 w − 1 . In addition, only odd values are allowed for this constant: Now it is time to provide some calculations. For example, Expressions (29) and (30) together give the following amount Q ac of congruent pairs to generate the same number of congruent sequences: Thus, Expression (31) shows the total quantity of possible congruent sequences having a length N = 2 w of random variables.
In stochastic PMTS the uniform twister plane generator nsDeonYuliPlaneTwist32D is used. In its twisting generations, the initial congruent sequence is Twister 0, which has a binary representation. The subsequent Twister 1 is organized according to the circular algorithm by simultaneously shifting all the numbers of the initial congruent sequence by one bit. As an example, Figure 8 shows a one-bit shift to the left for a sequence of three numbers 5, 3, 6 10 = 101, 011, 110 2 . The result of this shift is that the new sequence 010, 111, 101 2 = 2, 7, 5 10 is obtained. Therefore, the acquired twisting sequences are complete and contain the uniform random variables without skipping or repetitions. Moreover, twisting sequences are not linearly congruent. The amount , which characterizes the total number of congruent and twisting sequences together, is determined as follows: The amount of a complete set of random planes for one pair of congruent coefficients a and c is obtained by multiplying and w; this characterizes the number of different twisters including the congruent Twister 0: Furthermore, taking into account all the pairs of congruent coefficients a and c, the total number of generated twisting stochastic planes for one PMTS is determined by the following expression: Thus, Expression (9) shows the total number of different actions of uniformly switching on the LEDs located on the PMTS plane surface.
The problem of finding a solution for generating the uniform discrete twisting planes having the Descartes properties of the single presence of random points in a discrete matrix has been completed. In the context of this article it means that the task of creating software tools for providing the uniform stochastic twister generation of LED irradiation by PMTS is solved.

Conclusions
Analysis of the source material shows that the algorithms used by ordinary random number generators for plane realization do not take into account the advantages of absolutely uniform sequences of random variables. The generation technologies used in them do not guarantee the absolute uniformity of the completely random planes. Direct use of twisting generators of uniform sequences, for example nsDeonYuliTwist32D, is limited by the properties of Descartes uniform planes regarding the location of points. Using a technology of secondary indexing allows for creating the twister plane generator nsDeonYuliPlaneTwist32D, which ensures the completeness and uniqueness of all the random variables on the grid of the Descartes plane. In addition, using a variety of initial twisting sequences makes it possible to obtain new functional capabilities for PMTS. Specifically in our case, we demonstrated this possibility for constructing the uniform stochastic PMTS using LED irradiation sources.
Author Contributions: Conceptualization, Paper writing -original draft preparation, investigation, programming, validation, data curation, visualization, formal analysis, O.K.K.; Paper writing -original draft preparation and editing, conceptualization and methodology, software, programming and analysis, algorithm improvement, data curation, resources, A.F.D.; Paper writing -original draft preparation, review and editing, conceptualization and methodology, validation, project administration and supervision, resources and funding acquisition, Y.A.M. All authors have read and agreed to the published version of the manuscript. Therefore, the acquired twisting sequences are complete and contain the uniform random variables without skipping or repetitions. Moreover, twisting sequences are not linearly congruent. The amount Q CT , which characterizes the total number of congruent and twisting sequences together, is determined as follows: The amount Q 1CTP of a complete set of random planes for one pair of congruent coefficients a and c is obtained by multiplying Q CT and w; this characterizes the number of different twisters including the congruent Twister 0: Furthermore, taking into account all the pairs of congruent coefficients a and c, the total number of generated twisting stochastic planes Q CTP for one PMTS is determined by the following expression: Thus, Expression (9) shows the total number of different actions of uniformly switching on the LEDs located on the PMTS plane surface.
The problem of finding a solution for generating the uniform discrete twisting planes having the Descartes properties of the single presence of random points in a discrete matrix has been completed. In the context of this article it means that the task of creating software tools for providing the uniform stochastic twister generation of LED irradiation by PMTS is solved.

Conclusions
Analysis of the source material shows that the algorithms used by ordinary random number generators for plane realization do not take into account the advantages of absolutely uniform sequences of random variables. The generation technologies used in them do not guarantee the absolute uniformity of the completely random planes. Direct use of twisting generators of uniform sequences, for example nsDeonYuliTwist32D, is limited by the properties of Descartes uniform planes regarding the location of points. Using a technology of secondary indexing allows for creating the twister plane generator nsDeonYuliPlaneTwist32D, which ensures the completeness and uniqueness of all the random variables on the grid of the Descartes plane. In addition, using a variety of initial twisting sequences makes it possible to obtain new functional capabilities for PMTS. Specifically in our case, we demonstrated this possibility for constructing the uniform stochastic PMTS using LED irradiation sources.