PDA

View Full Version : random strings


Noiz Pollution
Mon 5th Jan '04, 1:36pm
hi folks,

i'm looking to create a random string consisting of 11 characters (alphanumeric) to create a unique identifier for an email wine voucher so people can claim a free bottle of wine with it and only be able to use it once

anybody got any ideas how i'd go about generating this string?


cheers,
Robert

CeleronXT
Mon 5th Jan '04, 7:01pm
$randomstring = substr(md5(microtime()), 0, 11);
Would this do it?

It can generate the same two random strings if two people access it within the same millisecond, but other than that it should be pretty random.

Noiz Pollution
Tue 6th Jan '04, 2:39pm
celeron that's exactly what i'm looking for :D

much appreciated,
Robert