МЕТОДИКА ОБУЧЕНИЯ ГЕНЕРАТОРАМ ПСЕВДОСЛУЧАЙНЫХ ЧИСЕЛ: МОДЕЛЬ АЛГОРИТМИЧЕСКОГО КОНСТРУИРОВАНИЯ, ИНТЕРАКТИВНОГО АНАЛИЗА И ОЦЕНКИ КАЧЕСТВА

This article is available in Russian only.
Цитировать:
Choriyev B.Sh. METHODOLOGY FOR TEACHING PSEUDORANDOM NUMBER GENERATORS: A STAGED MODEL FOR ALGORITHMIC CONSTRUCTION, INTERACTIVE ANALYSIS, AND QUALITY EVALUATION // Universum: психология и образование : электрон. научн. журн. 2026. 7(145). URL: https://7universum.com/en/psy/archive/item/23126 (дата обращения: 07.07.2026).
Прочитать статью:
Статья поступила в редакцию: 22.06.2026
Принята к публикации: 29.06.2026
Опубликована: 08.07.2026

 

УДК 004.9+519.248

Abstract

This article develops a methodology for teaching pseudorandom number generators (PRNGs) in technical higher education. The content is structured around the chapter theme “Methodology for Teaching Pseudorandom Number Generators” and covers four interconnected directions: step-by-step generation of random-like sequences, interactive instruction of linear and nonlinear congruential generators, didactic interpretation of PRNG quality criteria, and a system of laboratory and independent learning tasks. The scientific novelty of the study lies in a staged didactic model that treats a generator not only as a formula or a library function but also as a computational experiment whose parameters, output and quality must be explained by the learner. The proposed model connects conceptual understanding, algorithmic construction, statistical diagnostics, practical application and reflective assessment. Numbered formulas are included as methodological anchors, allowing students to move from mathematical recurrence to code, from code to statistical evidence, and from statistical evidence to a justified conclusion. The approach is intended to improve algorithmic thinking, technical accuracy, and the ability to evaluate random-like sequences in educational and applied contexts.

Аннотация

В данной статье разработана методология преподавания генераторов псевдослучайных чисел (ГПСЧ) в техническом высшем образовании. Содержание структурировано вокруг темы главы «Методология преподавания генераторов псевдослучайных чисел» и охватывает четыре взаимосвязанных направления: пошаговое генерирование случайных последовательностей, интерактивное обучение линейным и нелинейным конгруэнтным генераторам, дидактическая интерпретация критериев качества ГПСЧ и система лабораторных и самостоятельных учебных заданий. Научная новизна исследования заключается в поэтапной дидактической модели, которая рассматривает генератор не только как формулу или библиотечную функцию, но и как вычислительный эксперимент, параметры, выходные данные и качество которого должны быть объяснены обучающимся. Предложенная модель связывает концептуальное понимание, алгоритмическое построение, статистическую диагностику, практическое применение и рефлексивную оценку. В качестве методических ориентиров включены пронумерованные формулы, позволяющие студентам переходить от математической рекуррентности к коду, от кода к статистическим данным и от статистических данных к обоснованному выводу. Данный подход призван улучшить алгоритмическое мышление, техническую точность и способность оценивать последовательности, подобные случайным, в образовательных и прикладных контекстах.

 

Keywords: pseudorandom number generator; PRNG; teaching methodology; linear congruential generator; nonlinear generator; statistical testing; interactive learning; algorithmic thinking; independent learning.

Ключевые слова: генератор псевдослучайных чисел; PRNG; методика обучения; конгруэнтный генератор; статистическая оценка; интерактивное обучение; алгоритмическое мышление.

 

1. Introduction

Pseudorandom number generators are used in simulation, computer graphics, statistical modelling, educational testing, game mechanics, artificial intelligence experiments and information security. Although their output may look random, most software-generated sequences are produced by a deterministic rule and can be reproduced from an initial state. For this reason, PRNG instruction cannot be limited to showing a ready-made random function. Students need to understand how the sequence is generated, why parameters matter, how quality can be checked and where the limits of a particular generator appear.

In many programming courses, the topic is presented through a short formula, a small fragment of code and a demonstration of several generated values. This is useful for a first acquaintance, but it does not form a stable methodological understanding. A student may learn to call a library function while remaining unable to explain the difference between true randomness and pseudorandomness, the effect of a seed value, or the reason why a generator that “looks random” can still be unsuitable for a practical task.

The aim of this article is to present the chapter theme “Methodology for Teaching Pseudorandom Number Generators” as an integrated scientific and methodological article. The article covers four core components of the chapter: methods for generating random-like sequences step by step, interactive instruction of linear and nonlinear congruential generators, teaching of PRNG quality criteria, and the design of practice-oriented classroom and independent learning tasks.

The scientific novelty of the proposed approach is a staged teaching model based on the sequence “conceptual understanding – algorithmic construction – statistical diagnostics – practical application – reflective evaluation”. In this model, every formula becomes a didactic object that can be calculated, programmed, tested, compared and defended by the learner.

2. Theoretical and didactic basis

The first methodological challenge is to separate the visual impression of randomness from the mathematical mechanism that produces the sequence. A PRNG is deterministic: the next value is calculated from the current state and a selected set of parameters. In the classroom, this idea should be introduced before coding begins, because it changes the learner’s attention from “the program produced numbers” to “the rule produced a reproducible sequence”.

Xₙ₊₁ = f(Xₙ, θ) mod m, n = 0, 1, 2,                                                         (1)

In formula (1), Xₙ is the current state, θ denotes the set of generator parameters, and m is the modulus or limiting range. From a teaching perspective, this recurrence is important because it shows that pseudorandomness is not a mysterious property of the computer. It is the result of a rule, an initial value and a chosen numerical domain.

The second challenge is parameter interpretation. Students often copy values for a, c or m without understanding that small parameter changes may alter the period, distribution and visible patterns of the sequence. Therefore, parameter selection should be taught through experiments: students change one parameter at a time, record the output, compare periods and describe the difference in a short technical explanation.

The third challenge is quality evaluation. A generator cannot be judged only by several “mixed” looking numbers. The period, uniformity, correlation, entropy, reproducibility and fitness for a specific task must be considered together. This requirement turns PRNG instruction into an interdisciplinary learning activity that connects discrete mathematics, programming and statistics.

3. Step-by-step model for sequence generation

The first stage of the proposed model is motivation through application. The teacher begins with tasks in which random-like values are needed: shuffling test questions, simulating an event, choosing a random sample, estimating a value by the Monte Carlo method or generating an educational game scenario. When the need is clear, students are ready to ask how the computer can imitate randomness.

The second stage is manual construction. A small modulus is selected and the learners calculate several iterations by hand. This stage is deliberately simple. Its purpose is to make the recurrence visible and to show that the same seed always produces the same sequence. The linear congruential generator is especially suitable for this stage because its structure is compact and transparent.

Xₙ₊₁ = (aXₙ + c) mod m                                                               (2)

Here a is the multiplier, c is the increment, m is the modulus, and X₀ is the seed. During instruction, each symbol must be connected with an action in the program: multiplication, addition, modular reduction and storage of the next state. This connection prevents mechanical memorization and helps the student see formula (2) as an algorithm.

The third stage is normalization. After integer values have been generated, students convert them to the interval [0, 1). This operation is simple, but it is methodologically important because many simulations and probability models expect values in that interval.

Uₙ = Xₙ / m, 0 ≤ Uₙ < 1                                                            (3)

The fourth stage is program implementation. Students implement the same rule in Python, C++, JavaScript or a spreadsheet environment and generate sequences of different lengths. At this point the learning goal is not only to make the program run. The main goal is to observe how the generator behaves when the number of generated values increases.

The fifth stage is reflection. Learners answer questions such as: Which parameter caused a shorter period? Which output looked uniform but failed a statistical check? Why is reproducibility useful in testing? Such questions transform the laboratory task into a small research exercise.

4. Interactive teaching of linear and nonlinear generators

Interactive methods are essential because PRNG behaviour is easier to understand when students can manipulate parameters and immediately see the consequences. One effective format is a “parameter laboratory”. Groups of students select different values of a, c, m and X₀, generate sequences, calculate the period and compare the results. The teacher guides the process but does not give the final conclusion in advance.

A second interactive format is the “generator duel”. One group designs a linear congruential generator, another group experiments with a nonlinear generator, and a third group evaluates both using common quality indicators. At the end, each group defends its decision with numerical evidence. This format develops technical argumentation and encourages students to treat generator design as an engineering problem.

Nonlinear generators should be introduced after students understand the linear model. They do not need to be presented as more formulas to memorize. They should be used to show how a small change in the rule can make the output more complex, but also more difficult to analyse. A nonlinear congruential form may be written as follows:

Xₙ₊₁ = (aXₙ² + bXₙ + c) mod m                                              (4)

Another useful educational example is the logistic recurrence. It is not a universal PRNG for all applications, but it helps students observe sensitivity to parameters and initial conditions. The formula can be used to discuss why complexity alone is not the same as quality.

xₙ₊₁ = r xₙ(1 − xₙ), 0 < xₙ < 1                                            (5)

The methodological value of formulas (4) and (5) is comparative. Students can place the output of the linear and nonlinear models side by side, plot consecutive pairs, identify patterns and write a short explanation of why a visually irregular sequence still requires systematic evaluation.

5. Teaching PRNG quality criteria

Quality evaluation must be built into the learning process, not left as a separate theoretical topic. Students should learn that a PRNG is not “good” simply because its values seem irregular. A reliable classroom assessment should combine several criteria: period length, uniform distribution, weak correlation, adequate entropy, reproducibility and relevance to the task.

Uniformity can be explained through a frequency table and the chi-square statistic. First, students divide the interval [0, 1) into k equal subintervals. Then they compare the observed number of values in each interval with the expected number. The formula is written in a numbered form so that it can be referenced in laboratory reports.

χ² = Σᵢ₌₁ᵏ ((Oᵢ − Eᵢ)² / Eᵢ)                                              (6)

In formula (6), Oᵢ is the observed frequency and Eᵢ is the expected frequency in the i-th interval. The educational purpose is not to overload students with advanced statistics, but to show that quality can be supported by measurable evidence.

Correlation is another important criterion. If neighbouring or lagged values are strongly related, the sequence may create hidden patterns. A simplified autocorrelation indicator can be introduced as follows:

ρ(k) = Σₙ₌₁ᴺ⁻ᵏ (Uₙ − Ū)(Uₙ₊ₖ − Ū) / Σₙ₌₁ᴺ (Uₙ − Ū)²                      (7)

Formula (7) helps students understand that two sequences may have similar histograms while behaving differently in time. This is why scatter plots of Uₙ and Uₙ₊₁ are useful in the classroom. Visible lines, grids or clusters can become discussion points rather than merely graphical output.

Entropy can be used as a general indicator of uncertainty in the observed distribution. For educational purposes, entropy is introduced after students have already built the frequency table, because the probabilities pᵢ are obtained from that table.

H = −Σᵢ₌₁ᵏ pᵢ log₂(pᵢ)                                       (8)

The methodological conclusion is that no single indicator should be treated as an absolute verdict. A generator may be fast but have a short period; it may pass a simple uniformity check but show correlation; it may be reproducible for testing but not suitable for security. Therefore, an integrated educational score may be used for formative assessment.

Q = w₁P + w₂D + w₃C + w₄E + w₅R, Σᵢ₌₁⁵ wᵢ = 1               (9)

In formula (9), P denotes the period criterion, D denotes distribution quality, C denotes correlation behaviour, E denotes entropy, and R denotes relevance to the practical task. The weights wᵢ are set by the teacher according to the learning objective. For example, a simulation task may give more weight to distribution and correlation, while a debugging task may emphasize reproducibility.

6. Practical classes and independent learning tasks

The system of practical classes should follow the principle of gradual complexity. In the first class, students calculate a short sequence by hand and find its period. In the second class, they implement the LCG in a programming language and compare several parameter sets. In the third class, they generate a larger dataset and build a frequency table. In the fourth class, they evaluate two or more generators using formulas (6)-(9).

Independent learning tasks should require more than code submission. Each student report should contain the selected formula, parameter values, seed, generated sample size, tables, graphs, quality indicators and a short conclusion. This structure teaches students to present a computational result as a technical argument.

Project tasks may include shuffling educational test questions, estimating pi by the Monte Carlo method, creating a simple password generator for a non-security demonstration, modelling a random event in a game, or comparing the output of a built-in library function with a manually implemented generator. In every case, the output should be evaluated rather than simply displayed.

Assessment should also be multi-component. A balanced rubric may assign 30 percent to a working program, 25 percent to mathematical explanation, 25 percent to statistical analysis, 10 percent to visualization, and 10 percent to reflection. Such a rubric makes the assessment transparent and prevents students from focusing only on syntax.

7. Outcomes and discussion

The proposed methodology changes the role of PRNG instruction. Instead of being a small programming example, it becomes a learning module that develops algorithmic thinking, mathematical interpretation, statistical reasoning and research-style reporting. Students learn to ask not only whether the program works, but also whether the generated sequence is appropriate for the intended task.

The discussion reveals three methodological balances. The first balance is between formula and code: without a formula, the code becomes imitation; without code, the formula remains abstract. The second balance is between simple and complex models: the LCG is convenient for understanding, while nonlinear models reveal the need for deeper evaluation. The third balance is between output and evidence: generating numbers is not enough; the learner must justify the quality of the sequence with indicators and explanation.

This approach is especially relevant for computer engineering, software engineering, information security, mathematical modelling and data science courses. It allows the teacher to connect PRNGs with real educational contexts and gives students a practical framework for moving from theoretical recurrence to responsible computational use.

Conclusion

The methodology for teaching pseudorandom number generators is an important component of modern technical education because PRNGs are used in many computational systems. The article has presented a staged model that covers generation methods, interactive analysis of linear and nonlinear congruential generators, quality criteria, and a system of practice-oriented learning tasks.

The scientific novelty of the article is expressed in the “formula – code – statistical evidence – practical conclusion” teaching chain. This chain helps students develop not only programming skills but also the ability to explain parameters, evaluate output, compare generator behaviour and write a justified technical conclusion. Future work may focus on developing an electronic laboratory module, an automated rubric for PRNG assessment and a bank of interactive tasks for independent learning.

 

References:

  1. Knuth D.E. The Art of Computer Programming. Vol. 2: Seminumerical Algorithms. 3rd ed. Addison-Wesley, 1997.
  2. Hull T.E., Dobell A.R. Random number generators // SIAM Review. – 1962. – № 3. – P. 230⁠–⁠254.
  3. Park S.K., Miller K.W. Random number generators: good ones are hard to find // Communications of the ACM. – 1988. – № 10. – P. 1192⁠–⁠1201.
  4. Matsumoto M., Nishimura T. Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator // ACM Transactions on Modeling and Computer Simulation. – 1998. – № 1998. – P. 3⁠–⁠30.
  5. Marsaglia G. Xorshift RNGs // Journal of Statistical Software. – 2003. – № 14. – P. 1⁠–⁠6.
  6. Rashidovich B.G., Ugli N.B.U., & Ugli N.B.B. (2026). Using ai to make a sophisticated decision-making system that can advise you in real time whether to stop or keep going at pedestrian crossings. Universum: технические науки, 6(1 (142)), 50⁠–⁠54.
  7. Ugli N.B.U., & Bakhtiyorovna N.S. (2026). Advanced biometric authentication systems: an in-depth study of algorithmic models, security threats, and multimodal evaluation frameworks. Universum: технические науки, 6(1 (142)), 64⁠–⁠68.
  8. Ugli N.B.U., & Ugli A.T.K. (2026). Adaptive multimodal biometric authentication systems: a human-centered analysis of design, evaluation, and security challenges. Universum: технические науки, 6(1 (142)), 69⁠–⁠72.
  9. Abdunazarovna P.G. (2026). A Project-based way to use open biological data in bioinformatics education. Universum: психология и образование, 2(1 (139)), 31⁠–⁠32.
  10. Rakhmonov, Z., & Pardaeva, G. (2021). Steps of Organizing the Methodology of Improvement of Methods of Distance Learning of Students. In International Conference on Information Science and Communications Technologies: Applications, Trends and Opportunities, ICISCT 2021.
  11. Pardayeva G.A., Choriyev B.S., & Sulaymonova D.B. (2025). Sun’iy intellekt texnologiyalariga asoslangan raqamli ta’limda adaptiv o ‘qitish metodikasining nazariy modeli va amaliy asoslari. Inter education & global study, 3(10 (1)), 256⁠–⁠265.
  12. Bobur, K. (2026). The importance of a competency-based approach in data analysis. Universum: психология и образование, 2(1 (139)), 33⁠–⁠37.
Информация об авторах

стажер-преподаватель факультета прикладной математики и интеллектуальных технологий,
Национальный университет Узбекистана имени Мирзо Улугбека,
Узбекистан, г. Ташкент

ISSN 2311-6099. Article metadata is hosted on the eLIBRARY.RU platform.
Mass media registration cert.: EL No. FS77-54438 dated 17.06.2013
Journal founder: LLC «MCNO»
Editor-in-Chief - Nina P. Khodakova.
Top