samedi 12 décembre 2015

Generate random between alphanumeric min and max in PHP

I am looking for an approach like mt_rand to generate a random value, but between two alphanumeric values instead of integers.

For example, rand(g3j3j4k5, z9kDDkks8f8d).

I tried to convert the alphanumeric values to integers by base_convert. Beside the fact, it is somehow overkill, sometimes the integer is more than 15 digits, and thus not working in PHP rand functions.

NOTE: It is not about making a random string with given length. The value should between two given values, exactly like a random number between min and max integers.




Aucun commentaire:

Enregistrer un commentaire