Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator provides thread-safe convenience methods to generate random v4 UUIDs, leveraging a buffer to amortize the cost of reading from the random source.
func New ¶
func New() *Generator
New returns a new object that can be used to generate random v4 UUID instances, analogously to "github.com/google/uuid".New(). It leverages an internal buffer (via a thread-safe bufio.Reader) to amortize the cost of reading from the random source when generating a large number of UUIDs. This behavior is similar to "github.com/google/uuid".EnableRandPool, but confined to this specific generator instance, so that it can be used when security is not a concern (i.e., it is not a problem that the buffer is stored on the Go heap), without needing to enable it globally. In addition, the generator provides a NewInto method that does not cause allocations (opposed to "github.com/google/uuid".NewRandomFromReader()).