# Phase Congruential White Noise Generator
## 1 Introduction
 \tag{2}\]  
Using the initial autvector (2), the next autvector \({}^{0}Z_{1}\) could be obtained, which is shifted one counting to the right relative to the autvector \({}^{0}Z_{0}\). Autovector \({}^{0}Z_{1}\) contains part of countings of the signal \(S_{0}\) starting from the counting \(c_{01}\in S_{0}\). Herewith, only the last counting in the autovector \({}^{0}z_{1,n-1}\in{}^{0}Z_{1}\) belongs to the signal \(S_{1}\). Formation of autovector \({}^{0}Z_{1}\) contains the following steps:  
\[ \begin{split}{}^{0}z_{1,0}&=c_{0,1},\\ {}^{0}z_{1,1}&=c_{0,2},\ldots\\ {}^{0}z_{1,n-2}&=c_{0,n-1},\\ {}^{0}z_{1,n-1}&=c_{1,0}\end{split}  \tag{3}\]  
From Formulas (2) and (3) it follows that the last autovector relative to the pair of signals \(S_{0}\) and \(S_{1}\) contains only one counting from the signal \(S_{0}\), and the remaining \(n-1\) countings are taken from the signal \(S_{1}\) as follows:  
\[ \begin{split}{}^{0}z_{n-1,0}&=c_{0,n-1},\\ {}^{0}z_{n-1,1}&=c_{1,0},\ldots\\ {}^{0}z_{n-1,n-2}&=c_{1,n-3},\\ {}^{0}z_{n-1,n-1}&=c_{1,n-2}\end{split}  \tag{4}\]  
Thus, with respect to signal \(S_{0}\) Formula (4) completes the formation of all autvectors \({}^{0}Z_{0},\cdots,{}^{0}Z_{n-1}\). Now it is obviously seen that such a structure of autovectors is able to compose the matrix with dimensions \(n\times n\). The countings of each autovector \({}^{0}Z_{i}\) occupy the corresponding row \(i\) in the matrix \({}^{0}Z\). The values in line 0 correspond to the signal \(S_{0}\) and the autovector \({}^{0}Z=S_{0}\). Line 1 contains the countings of autovector \({}^{0}Z_{1}\). The last row of the matrix \({}^{0}Z\) keeps the autovector \({}^{0}Z_{n-1}\). Below is the program _P070101_, in which according to Formula (1) the autvectors \({}^{0}Z_{i}\) are created in the matrix \({}^{0}Z\) using the _Random_ generator from the algorithmic language \(C\#\). The theoretical value of the amount of countings \(n\) has been replaced by a program variable named \(NS\). As an example, in this particular case, the number of countings in signal is taken as \(NS=33\), although the values for \(NS\) can be chosen arbitrarily up to \(NS<2^{31}\). The values of countings \(c_{0,j}\) of the theoretical initial signal \(S_{0}\) are stored in the elements of the program array \(s0\). Theoretical autovectors \({}^{0}Z_{i}\) are located in the program matrix \(z\). namespace P070101  { class cP070101  { static void Main(string[] args)  { const int NS = 33; // signal counter quantity } } } {\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{ \rm{ \rm{ \rm{ } } \rm{{ }}}}}}}}}}}}}}}\) } {\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{\rm{ \rm{ \rm{ \rm{ } }}}}}}}}}}}}}}}}}}\)  
\(\{\rm{\rmRandom rdm = new Random(0); // integer random generator double max = (double)0x7 FFFF; double[] s0 = new double [NS]; // initial signal s0 for (int i = 0; i < NS; i++) s0[i] = 4.0 * ((double)rdm.Next() / max - 0.5); Console.Write(\"S0 =\"); for (int i = 0; i < NS; i++) { if (i % 6 == 0) Console.WriteLine();  Console.Write(\"[0,8:F3]\", s0[i]); } Console.WriteLine(); // matrix z for vectors double[,] z = new double[NS,NS]; MatrixZ(z, s0, rdm, NS, max); Console.WriteLine(\"Z =\"); for (int i = 0; i < NS; i++) { Console.Write(\"[0,8:F3]\", z[i, 0]);  Console.Write(\"[0,8:F3]\", z[i, 1]);  Console.Write(\"[0,8:F3]\", z[i, 2]);  Console.Write(\"[0,8:F3]\", z[i, NS-2]);  Console.WriteLine(\"[0,8:F3]\", z[i, NS-1]); } Console.ReadKey(); // result viewing } //------------------------------------------------ static void MatrixZ (double [,] z, double[] s0, Random rdm, int NS, double max) { for (int j = 0; j < NS; j++) z[0, j] = s0[j]; for (int k = 1; k < NS; k++) // vector shift { for (int j = 0; j < NS - 1; j++)  z[k, j] = z[k - 1, j + 1];  z[k, NS - 1] = 4.0*(double)rdm.Next()/max-0.5); } } } } } } ```
After starting the program _P070101_, the following outcome appears on the monitor. In order to reduce the presentation of the entire listing of results, omitted values are replaced by a dash.