Skip to content

Conversation

@AhmedHisham552
Copy link
Contributor

@AhmedHisham552 AhmedHisham552 commented Sep 6, 2025

Motivation / Background

This Pull Request has been created to fix issue #3114, a bug in Faker::Bank.account_number where generated values could sometimes include scientific notation (e.g., 3512553848424886e-05) due to using rand.to_s[2..].

This resulted in invalid bank account numbers containing non-digit characters.

The new implementation ensures that account numbers always consist of digits only.

Additional information

  • The fix uses integer-based digit generation, avoiding reliance on stringified floats.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug, refactor something, or add a feature.
  • Tests and Rubocop are passing before submitting your proposed changes.

If you're proposing a new generator or locale:

  • Double-check the existing generators documentation to make sure the new generator you want to add doesn't already exist.
  • You've reviewed and followed the Contributing guidelines.

@AhmedHisham552 AhmedHisham552 changed the title fix : prevent scientific notation when generating bank account number fix: prevent scientific notation when generating bank account number Sep 6, 2025
@AhmedHisham552 AhmedHisham552 changed the title fix: prevent scientific notation when generating bank account number fix #3114: prevent scientific notation when generating bank account number Sep 6, 2025
Copy link
Contributor

@jremes-foss jremes-foss left a comment

Choose a reason for hiding this comment

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

LGTM ✅

Copy link
Contributor

@thdaraujo thdaraujo left a comment

Choose a reason for hiding this comment

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

thanks!

@thdaraujo thdaraujo merged commit c29e8ae into faker-ruby:main Nov 1, 2025
8 checks passed
stefannibrasil pushed a commit that referenced this pull request Jan 8, 2026
…3118)

Co-authored-by: Ahmed Hisham <104331123+octohisham@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants