Published: 2026-04-20

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

DOI: 10.35870/ijsecs.v6i1.7158

No Cover Available
Article Metrics
Share:

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.

Keywords

Random Number Generator; LCG; Number Guessing; Game; Python

Peer Review Process

This article has undergone a double-blind peer review process to ensure quality and impartiality.

Indexing Information

Discover where this journal is indexed at our indexing page.

Open Science Badges

This journal supports transparency in research and encourages authors to meet criteria for Open Science Badges.

Most read articles by the same author(s)

More From The Same Author