Hello,
I want to generate a unique alphanumeric string having specific length and having specific characters used.

For example I want to create random string having several alphabets initially then
some numbers then some alphabets again.

e.g. (LETTER,NUMBER,LETTER,LETTER,NUMBER(A2EU7).

How can I create such string? Please help me. Thanks.

    You can use [man]rand/man or [man]mt_rand/man with [man]chr/man. The uniqueness requirement can only be absolutely satisfied by keeping a list of the string generated and checking that a new string does not match any of them. However, if your strings are sufficiently long, it may be tolerable to risk a highly improbable collision.

      Write a Reply...