title: Does randomUUID give a unique id?
body: <p>I am trying to create session tokens for my REST API. Each time the user logs in I am creating a new token by </p>
  
  <pre><code>UUID token = UUID.randomUUID();
  user.setSessionId(token.toString());
  Sessions.INSTANCE.sessions.put(user.getName(), user.getSessionId());
  </code></pre>
  
  <p>However, I am not sure how to protect against duplicate sessionTokens.</p>
  
  <p>For example: Can there be a scenario when user1 signs in and gets a token <code>87955dc9-d2ca-4f79-b7c8-b0223a32532a</code> and user2 signs in and <strong>also</strong> gets a token <code>87955dc9-d2ca-4f79-b7c8-b0223a32532a</code>. </p>
  
  <p>Is there a better way of doing this? </p>