views:

27

answers:

1

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
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
No sorry, didn't have the API to hand so that was from memory :)
Robert Wilson