faker icon indicating copy to clipboard operation
faker copied to clipboard

Cached cctype results in non-random data

Open codingconcepts opened this issue 2 years ago • 1 comments

Issue: The first time faker.CCType() is called, the value is internally cached, meaning subsequent calls will always return the same data:

https://github.com/go-faker/faker/blob/5effebba7fe9e25350305432ffdca5e19151edad/payment.go#L31

Fix: Remove the caching to ensure subsequent calls are sufficiently random.

codingconcepts avatar May 24 '23 14:05 codingconcepts

also this will result in data race issue if multiple faker.CCType() being called for the first time in parallel

unrealhoang avatar Jun 22 '23 09:06 unrealhoang