Note Submitter: Niels
----
The example from "relsqui at armory dot com" is wrong. It talks about bit operations and uses "&", but is actually an example of using modulus and should use "%". The idea is that "rand()%(x+1)" is faster than "rand(0,x)". I agree, it is. But not a lot.
Here's the fastest function I can think of for making pseudo-unique, valid IDs for HTML tags, in which the first character can't be a number:
function makeID() {
$s="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
return $s{rand()%52}.$s{rand()%62}.(repeat ad libitum).$s{rand()%62};
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.