Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure correct seed validation #3007

Merged
merged 1 commit into from
Oct 19, 2024
Merged

Commits on Oct 14, 2024

  1. fix(random): ensure correct seed initialization with falsy values

    The previous implementation used a direct property check (`config.seed`),
    which could inadvertently treat falsy values like `0` as missing, leading
    to incorrect random seed initialization.
    
    Changed the condition to explicitly check for the presence of the `seed`
    property using `Object.prototype.hasOwnProperty.call()`. This update
    ensures that seed initialization handles falsy but valid seed values
    correctly.
    
    Resolves stdlib-js#2952.
    
    This pull request addresses the bug where setting `seed=0` leads to
    non-deterministic behavior.
    
    No related issues.
    
    No questions for reviewers.
    
    No additional information relevant to this pull request.
    
    - [x] Read, understood, and followed the [contributing guidelines][contributing].
    
    ---
    
    @stdlib-js/reviewers
    
    [contributing]: https:/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md
    rishav2404 committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    22eeb94 View commit details
    Browse the repository at this point in the history