Skip to content

Singapore NricNumber generation algorithm produces invalid value #1593

@hieule3004

Description

@hieule3004

Describe the bug
A clear and concise description of what the bug is.

net.datafaker.idnumbers.NricNumber class CODE field has length 8 but is used to compute pair-wise weighted sum with random digits of length 7. The correct algorithm should have first value in array i.e. 0 removed.

To Reproduce
Code to reproduce

Expected behavior
A clear and concise description of what you expected to happen.

The value of new Faker(new Locale("en", "SG")).idNumber().singaporeanFin() should be valid with any online NRIC validator.

Versions:
Both Faker v1 and v2

Additional context
I have tested by patching the array and it works as expected.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions