Ah... the purists and their definition of random and unique...
This forum doesn't operate in a vacuum but within the context of PHP, in general, and PHP coding, in particular, and, as such, almost aways just around the corner from MySQL.
Within that real life context, random and unique have a more specific and practial meaning than in some math or statistics book. And I think we ought to keep that way...
Back to the issue of generating a random, unique number... A fairly simple and workable solution - if it fits in your scheme of things - could be to use the autoincrement feature of MySQL, as suggested by NogDog, to generate your primary index for your table. You could then generate a random number within a specified range and concatenate the two to form a numerical value which would be both random enough and unique within your table. This value would then be stored in a separate field in your table.
This could, eventually, result in a random number that will be longer than the six digits you are aiming for.