Skip to content

Conversation

@Dutcho
Copy link
Contributor

@Dutcho Dutcho commented Aug 23, 2025

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

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

Copy link
Collaborator

@fcurella fcurella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a unit test for regression purposes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First 8 digits of result of ssn() in 'nl_NL' provider are (needlessly) unique

2 participants