I need to test a random number generator which produces numbers randomly. How to make sure the numbers generated are random.
You cannot ensure the numbers are random simply because random numbers are, well, random.
The chances of getting a string of one million consecutive 9's is the same as getting any other specific one-million-long sequence. The one thing you can check for is correct distribution over a large sample set. Run a sizeable test and work out the relative occurrences of each possible outcome.
Over a large enough sample, they should be roughly the same.
One other possibility is to test for non-repeatability. Ideally, random numbers should not depend on the numbers that came before. Very simple (linear congruential) PRNGs will most likely give you the same sequence of numbers eventually but over a large enough set that you probably won't care (unless you're serious about randomness).