-
Hi! I use faker to generate some random data in my tests, but sometimes it generates 2 identical emails in the same test. What is the probability that it happens? Thank you. Regards. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Which locale are you using? There is faker.helpers.unique |
Beta Was this translation helpful? Give feedback.
-
In general it's quite common to get duplicates. Faker pulls from a fairly small set of first names, last names, and random numbers, and then you have an example of the birthday paradox - https://en.wikipedia.org/wiki/Birthday_problem - even if the number of possibilities is quite large, a relatively small number of attempts is likely to cause a duplicate . |
Beta Was this translation helpful? Give feedback.
-
I've seen faker.helpers.unique and faker.helpers.uniqueArray, and it seems useful to provide what I need. Thank you @ST-DDT for your hint. ;) Regards. |
Beta Was this translation helpful? Give feedback.
Which locale are you using?
Do you use no/a random or a fixed seed?
There is faker.helpers.unique