Skip to content Skip to sidebar Skip to footer

The Uniqueness Of Uuid Generated Using Boost Library Vs Java

An Android app from my organization needs to assign each users an UUID(version 4) when they first launch the app, currently we're using Boost library 1.58.0 for this purpose, our A

Solution 1:

The documentation for java.util.randomUUID() says the UUIDs it returns are "generated using a cryptographically strong pseudo random number generator". Thus, each such UUID will be almost certainly "unique" for most purposes (at least in Android versions after 4.3; see this question).

A version 4 UUID consists of 122 randomly chosen bits, so that there are at most 2^122 UUIDs of this kind. However, no randomly chosen value of finite length is guaranteed to be unique by itself.

Roughly speaking, when version 4 UUIDs are generated at random, the chance of accidental collision becomes non-negligible only after about 2^61 UUIDs are generated, which is about 2.7 billion billion (see "Birthday problem" for a precise statement and formulas).

Post a Comment for "The Uniqueness Of Uuid Generated Using Boost Library Vs Java"