Well, it depends.
A random number generated by a computer uses what is known as a Random Number Generator (RNG) that creates new 'random' numbers. To create a number using an RNG, you need a single number called a seed. This could be the system time, a manually entered number, a previously generated number, or something unpredictable and random by itself.
If the seed is a previously generated number, you need to use a good, unpredictable algorithm. Weak RNGs can be predicted over time, due to the flaws in them. To do so, you must:
1. Know what algorithm has been used.
2. Hope that it is weak, or has a programming flaw (indexes of arrays are often confused).
3. Know how to find such flaws (meaning you need to be good at maths, as well as programming).
4. Pray that you are right (since it is almost impossible to really exploit an RNG without an expert's help).
Note that once you have cracked the method, you should be able to get the number right every time, otherwise you are wrong. It is all-in or nothing, so your friend is just wasting his money (or not, since he is losing only by a small margin, he might just get lucky, and stop playing after winning once).
If the RNG is of some in-built function by a reputed brand (say, a DOS command echo %random%), just accept that it can't be cracked.
And there is no other way to predicting a randomly generated number, it is mathematically impossible.