Random numbers are used any time your program needs an element of chance or unpredictability. In game development this comes up constantly — enemy drops, procedural level generation, dice rolls, randomised dialogue, particle effects, loot tables, and spawn positions all rely on random numbers in some form.
It is worth knowing that computers cannot generate truly random numbers. What they produce are pseudorandom numbers — sequences generated by a mathematical formula that appear random but are actually deterministic. They start from a seed value, and the same seed will always produce the same sequence of numbers. This is actually useful in game dev — seeding your random number generator with a specific value lets you recreate the same randomly generated level or world every time, which is how games like Minecraft handle world generation.