Application of the Linear Congruential Generator Method in a Number-Guessing Game - Efani Desi; Yan Yang Thanri (International Journal Software Engineering and Computer Science (IJSECS), 2026)
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.