David boggled my poor little brain. He declared, to nobody in particular, but definitely loud enough for the air-conditioner to hear:
Fix the bloody air conditioning, and then I’ll put my clothes on.
It worked, because the temperature’s been dropping steadily ever since. Now we wait for David to make good on his end of the deal…
Here's a quick way to generate a short, random string in Java:
Random r = new Random(); String token = Long.toString(Math.abs(r.nextLong()), 36);
The resultant string is a maximum of
ceil(ln(263) / ln(36)) = 13 characters long and is suitable for use as a temporary id or cookie name.
An even quicker and dirtier method is to simply convert a random double to a string:
String token = "token" + Math.random();
This is useful in test cases and one-offs, but I wouldn't put it into production code.