Question: How are random numbers generated.? How do languages such as java etc generate random numbers, especially how it is done for GUIDs.? i found that algorithms like Pseudorandomnumber generator uses initial values. 

But i need to create a random number program, in which a number once occurred should never repeats even if the system is restarted etc. I thought that i need to store the values anywhere so that i can check if the number repeats or not, but it will be too complex when the list goes beyond limits.?

Answer: 
First: If the number is guaranteed to never repeat, it's not very random.

Second: There are lots of [PRNG algorithms](http://en.wikipedia.org/wiki/List_of_pseudorandom_number_generators).

UPDATE:

Third: There's an [IETF RFC for UUIDs](https://www.rfc-editor.org/rfc/rfc4122) (what MS calls GUIDs), but you should recognize that (U|G)UIDs are *not* cryptographically secure, if that is a concern for you.

UPDATE 2:

If you want to actually use something like this in production code (not just for your own edification) **please** use a pre-existing library. This is the sort of code that is almost guaranteed to have subtle bugs in it if you've never done it before (or even if you have).

UPDATE 3:

Here's the [docs for .NET's GUID](http://msdn.microsoft.com/en-us/library/system.guid.aspx)
Most random number generators have a way to "randomly" reïnitialize the seed value. (Sometimes called randomize).

If that's not possible, you can also use the system clock to initialize the seed.