File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,11 @@ package kallax
22
33import (
44 "bytes"
5+ "crypto/rand"
56 "database/sql"
67 "database/sql/driver"
78 "encoding/hex"
89 "fmt"
9- "math/rand"
10- "sync"
1110 "time"
1211
1312 "github.com/oklog/ulid"
@@ -227,13 +226,6 @@ type Record interface {
227226 Saveable
228227}
229228
230- var randPool = & sync.Pool {
231- New : func () interface {} {
232- seed := time .Now ().UnixNano () + rand .Int63 ()
233- return rand .NewSource (seed )
234- },
235- }
236-
237229// ULID is an ID type provided by kallax that is a lexically sortable UUID.
238230// The internal representation is an ULID (https://github.com/oklog/ulid).
239231// It already implements sql.Scanner and driver.Valuer, so it's perfectly
@@ -242,11 +234,7 @@ type ULID uuid.UUID
242234
243235// NewULID returns a new ULID, which is a lexically sortable UUID.
244236func NewULID () ULID {
245- entropy := randPool .Get ().(rand.Source )
246- id := ULID (ulid .MustNew (ulid .Timestamp (time .Now ()), rand .New (entropy )))
247- randPool .Put (entropy )
248-
249- return id
237+ return ULID (ulid .MustNew (ulid .Timestamp (time .Now ()), rand .Reader ))
250238}
251239
252240// NewULIDFromText creates a new ULID from its string representation. Will
You can’t perform that action at this time.
0 commit comments