Application of the Linear Congruential Generator Method in a Number-Guessing Game

Authors

  • Efani Desi Potensi Utama University
  • Yan Yang Thanri Potensi Utama University

DOI:

https://doi.org/10.35870/ijsecs.v6i1.7158

Keywords:

Random Number Generator, LCG, Number Guessing, Game, Python

Abstract

Number guessing games occupy a deceptively simple position in the landscape of interactive software — easy to play, yet dependent on a mechanism that most players never think about: the quality of the number being generated. If that number is predictable, the game collapses. If it is genuinely unpredictable, the experience holds. This study applies the Linear Congruential Generator (LCG) method as the core algorithm for random number generation in a number-guessing game operating within the range of 1 to 100. LCG was selected not because it is the most statistically sophisticated option available, but because its computational simplicity and deterministic structure make it well-suited to lightweight game applications where speed and transparency of implementation matter more than cryptographic strength. Four parameters govern the algorithm's behavior — modulus, multiplier, increment, and seed — and each was configured deliberately to produce a distribution that remains acceptably uniform across repeated sessions. The seed value, generated dynamically at runtime, ensures that no two sessions begin from the same starting point, which is the primary mechanism for maintaining unpredictability from the player's perspective. Test results indicate that the application performs adequately: number distribution is reasonably balanced, the interface responds correctly to valid and invalid inputs, and the overall gameplay experience is fair. A more critical reading of the results, however, reveals that LCG carries inherent trade-offs — its period is finite, and under certain parameter configurations, detectable patterns can emerge in the generated sequence. For a single-player guessing game, these limitations are largely inconsequential. For applications requiring stronger statistical guarantees, they would not be. The application was built using Python with a graphical interface constructed through the tkinter library, making it accessible to users without any technical background. This study is intended as a practical reference for developers building number-based games and as a modest contribution to the applied literature on pseudo-random number generation in educational software.

Downloads

Download data is not yet available.

Author Biographies

  • Efani Desi, Potensi Utama University

    Department of Information System, Faculty of Enginnering and Computer Science, Potensi Utama University, Medan City, North Sumatra Province, Indonesia

  • Yan Yang Thanri, Potensi Utama University

    Department of Information System, Faculty of Enginnering and Computer Science, Potensi Utama University, Medan City, North Sumatra Province, Indonesia

References

Avdović, A. (2023). Extension of Linear Congruential Generator. Scientific Publications of the State University of Novi Pazar Series A: Applied Mathematics, Informatics and Mechanics, 15(2), 87–95. https://doi.org/10.46793/spsunp2302.087a

Bouras, A. (2024). Integrating randomness in large language models: A Linear Congruential Generator approach for generating clinically relevant content (pp. 1–13). arXiv. https://arxiv.org/abs/2407.03582

Bulolo, S. (2019). Implementasi metode Linear Congruent Method (LCM) pada simulasi ujian akhir sekolah menengah kejuruan Lolomatua. Prosiding Seminar Nasional Teknologi Informasi, 2(November), 60–64.

Fahrezi, G. R., Sakti, D. V. S. Y., & Muhardi, H. (2023). Implementasi Pseudo Random Number Generator (PRNG) dengan algoritma Linear Congruential Generator (LCG) pada permainan mengetik bertema Candi Prambanan. Jurnal Edukasi dan Penelitian Informatika, 9(2), 299. https://doi.org/10.26418/jp.v9i2.64713

Fanani, A. (2021). Pengacakan soal pada sistem Computer Based Test (CBT) dengan metode Linear Congruential Generator (LCG) di SMA Negeri Jogoroto. Jurnal Ilmiah Teknologi Informasi dan Sains, 1(2001), 50–56.

Faure, E., Fedorov, E., Myronets, I., & Sysoienko, S. (2022). Method for generating pseudorandom sequence of permutations based on Linear Congruential Generator. CEUR Workshop Proceedings, 3137, 175–185. https://doi.org/10.32782/cmis/3137-15

Gunadi, H. (2023). Aplikasi ujian online untuk SMA PKP JIS dengan metode Linear Congruential Generator (LCG) berbasis web. Jurnal KLIK, 4(2), 815–828. https://doi.org/10.30865/klik.v4i2.1175

Hameedi, B. A., Hattab, A. A., & Laftah, M. M. (2022). A pseudo-random number generator based on new hybrid LFSR and LCG algorithm. Iraqi Journal of Science, 63(5), 2230–2242. https://doi.org/10.24996/ijs.2022.63.5.35

Khan, S. S., Palmer, B., Edelmaier, C., & Aktulga, H. M. (2024). OpenRAND: A performance portable, reproducible random number generation library for parallel computations. SoftwareX, 27, 101773. https://doi.org/10.1016/j.softx.2024.101773

Luis Crespo, J., González-Villa, J., Gutiérrez, J., & Valle, A. (2024). Assessing the quality of random number generators through neural networks. Machine Learning: Science and Technology, 5(2). https://doi.org/10.1088/2632-2153/ad56fb

Nathan, N., & Mamza, S. A. (2020). Mathematical Journal of Interdisciplinary Sciences, 8(2), 61–68.

Pandit, K. (2019). Linear congruential generator and caesar cipher. International Journal of Engineering and Advanced Technology, 9(1), 2248–2250. https://doi.org/10.35940/ijeat.A9731.109119

Perbawa, K. A., & Diana, D. (2022). Application of Linear Congruential Generator (LCG) algorithm in Android based mathematics education game. Jurnal Komputer, Informasi dan Teknologi, 2(1), 47–56. https://doi.org/10.53697/jkomitek.v2i1.599

Ramadan, A. N. (2024). Simulasi penyingkat URL menggunakan Linear Congruential Generator (LCG). Institut Teknologi Bandung.

Riis, S. (2026). Term coding: An entropic framework for extremal combinatorics and the guessing-number sandwich theorem. arXiv. https://arxiv.org/abs/2601.16614

Safitri, D. N. (2021). Implementasi metode Linear Congruential Generator pada game puzzle kesenian tari. JATISI (Jurnal Teknik Informatika dan Sistem Informasi), 8(1), 129–140. https://doi.org/10.35957/jatisi.v8i1.632

Soto-León, V., Arco, J. M., Martínez-Pérez, M. Á., Oliviero, A., & Aguilar, J. (2023). Effects of transcranial static magnetic field stimulation over the left dorsolateral prefrontal cortex on random number generation. Clinical Neurophysiology, 149, 18–24. https://doi.org/10.1016/j.clinph.2023.02.163

Sumiah, A., & Hakim, R. R. (2021). Implementasi metode Linear Congruential Generator pada game puzzle berbasis Android. JEJARING (Jurnal Teknologi dan Manajemen Informatika), 8(1), 129–140. https://doi.org/10.35957/jatisi.v8i1.632

Triwibowo, D. N., Purwono, Ashari, I. A., Sandi, A. S., & Rahman, Y. F. (2021). Enkripsi pesan menggunakan algoritma Linear Congruential Generator (LCG) dan konversi kode Morse. Buletin Ilmiah Sarjana Teknik Elektro, 3(3), 194–201. https://doi.org/10.12928/biste.v3i3.5546

Wardana, S. C. P., & Sabrina, S. S. J. N. (2025). Game tebak angka multipemain dengan penilaian skor otomatis menggunakan bahasa C++. Jurnal Komputasi dan Pengembangan Aplikasi, 1(3), 22–29. https://journals.arces.org/jukompak/.

Downloads

Published

2026-04-20

Issue

Section

Articles

How to Cite

Desi, E., & Thanri, Y. Y. (2026). Application of the Linear Congruential Generator Method in a Number-Guessing Game. International Journal Software Engineering and Computer Science (IJSECS), 6(1), 268-278. https://doi.org/10.35870/ijsecs.v6i1.7158

Most read articles by the same author(s)