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

Add new constructor to faker #132

Open Kingmidas74 opened 1 year ago

Kingmidas74 commented 1 year ago

Description

I've added new constructor with pure number as parameter. It can simplify client code. We can reduce imports and pass rand.Source into the package

Go Version

$ go version
go version go1.19.5 darwin/arm64

Go Tests

$ go test
2023/02/27 22:30:26 Error while requesting https://loremflickr.com/300/200 : request failed
2023/02/27 22:30:26 Error while creating a temp file: temp file creation failed
2023/02/27 22:30:27 Error while requesting https://thispersondoesnotexist.com/image : request failed
2023/02/27 22:30:27 Error while creating a temp file: temp file creation failed
PASS
ok      github.com/jaswdr/faker 5.388s
jaswdr commented 1 year ago

Thank you for the contribution. There is one failed check from DeepSource related with the weak random number and the math/rand package. Would you mind replacing the math/rand with crypto/rand so we can get rid of this warning?