NewRandom returns a Random (Version 4) UUID. The strength of the UUIDs is based on the strength of the crypto/rand package. Uses the randomness pool if it was enabled with EnableRandPool. A note about uniqueness derived from the UUID Wikipedia entry: Randomly generated UUIDs have 122 random bits
()
| 37 | // equivalent to the odds of creating a few tens of trillions of UUIDs in a |
| 38 | // year and having one duplicate. |
| 39 | func NewRandom() (UUID, error) { |
| 40 | if !poolEnabled { |
| 41 | return NewRandomFromReader(rander) |
| 42 | } |
| 43 | return newRandomFromPool() |
| 44 | } |
| 45 | |
| 46 | // NewRandomFromReader returns a UUID based on bytes read from a given io.Reader. |
| 47 | func NewRandomFromReader(r io.Reader) (UUID, error) { |