I would like to generate an id for a poll that can be used in links. The id should not be not to easy to guess. Is there a preferred way to generate such an id on google app engine?
+3
A:
UUID - http://en.wikipedia.org/wiki/UUID
String key = UUID.createNewUUID().toString();
As close to unique as makes no odds, and impossible to 'guess'.
Robert Wilson
2010-07-20 08:30:09
java.util.UUID does not have createNewUUID. I'm using UUID.randomUUID().toString(), looks great. Do you recommend something else than the jdk implementation?
tkr
2010-07-20 08:57:16
No sorry, didn't have the API to hand so that was from memory :)
Robert Wilson
2010-07-20 10:33:34