Computers aren't actually capable of doing things randomly; instead, programs use a "pseudo-random number generator" algorithm (PRNG or just RNG) as a source of numbers which appear random to humans, and use those numbers to make decisions. The PRNG is in turn "seeded" by a clock, user input, or a dedicated hardware component. See TASVideos for more on how RNG works in games.
"Randomness" or "RNG" is not to be confused with "nondeterministic behaviour".