faker icon indicating copy to clipboard operation
faker copied to clipboard

Nl nl ssn issue #2253

Open Dutcho opened this issue 4 months ago • 0 comments

What does this change

Fix issue #2253 on ssn() in 'nl_NL' provider.

What was wrong

Generated ssn() values had unique leading 8 digits, which is not a BSN (Dutch ssn) requirement. As a consequence the range (number of possible values) was limited to 10! / 2! * 9 / 10.

How this fixes it

Replace random.sample() by random.choices() and continue in case digits[:2] == [0, 0] in ssn() code. Now the range is 10 ** 8 * 99 / 100 * 9 / 10, and I generated 20 million unique BSN's without issue (other than 2.6 million collisions).

Checklist

  • [X] I have read the documentation about CONTRIBUTING
  • [X] I have read the documentation about Coding style
  • [ ] I have run make lint (I didn't install locally)

Dutcho avatar Aug 23 '25 23:08 Dutcho