It's an interesting question, since computers try very hard to be deterministic.
It's even difficult physically to get anything random at a macroscopic scale. Dice rolls aren't really random if you know the exact initial conditions and environment, all the laws of physics, and have enough computation power.
So computers may settle for something like measuring noise, which is random enough since nobody can practically predict it.
That's pretty slow on normal hardware though. So this random number is often used to generate a whole series of numbers. These are calculated deterministically, but the pattern is very unpredictable, so they can be considered random for many purposes.
Sometimes being unpredictable isn't so important, and one can just use the current time, or something else as seed. This might not be a wise thing to do in cryptography or a lottery, but could be okay for initializing a neural network.
This fake randomness also has one advantage: the random numbers can be made predictable for testing. Consider for example Monte Carlo simulations in physics. The numbers should be "random" (without clear pattern). But it'd be nice to repeat the whole process if there's a problem. So you just choose a fixed seed, which will cause the same pseudo-random numbers to be generated each time. Same with neural networks.
Generating random numbers will be really easy to do with quantum computers, by the way :-) Quantum mechanics , unlike physics at daily life scales, is inherently probabilistic.