I don't know if this is an issue for what you are doing or not, but note that rand() only promises to generate a (pseudo) random number. It is not necessarily unique, so there is always a possibility that any value it generates will be a duplicate of a previously generated one. If this is an issue, you might look into using uniqid().
$random = "DDD" . md5(uniqid(''));
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation