jaswdr / faker

:rocket: Ultimate fake data generator for Go with zero dependencies
https://pkg.go.dev/github.com/jaswdr/faker
MIT License
566 stars 59 forks source link

Update the Variant bits in method V4() of uuid.go #144

Closed MrTbag closed 1 year ago

MrTbag commented 1 year ago

Description

I changed the way the Variant bits were set in method V4() of uuid.go

Are you trying to fix an existing issue?

I'm trying to fix issue #134

The variant bits are set to RFC4122 by AND-ing the original bits with 0x3f and OR-ing them with 0x80. Now, each time you run the code, it should generate a random UUID version 4

Go Version

$ go version
go version go1.19.5 windows/amd64   

Go Tests

$ go test

=== RUN   TestUUIDv4
--- PASS: TestUUIDv4 (0.00s)
PASS
ok      github.com/jaswdr/faker 0.034s

=== RUN   TestUUIDV4UniqueInSequence
--- PASS: TestUUIDV4UniqueInSequence (0.00s)
PASS
ok      github.com/jaswdr/faker 0.025s

web_1402_issue

jaswdr commented 1 year ago

LGTM

jaswdr commented 1 year ago

@MrTbag your changes were released in v1.18.1. Congratulations for your first PR 🎉