Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-random/rand
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 98a1aaf
Choose a base ref
...
head repository: rust-random/rand
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6a6b9fd
Choose a head ref
  • 10 commits
  • 6 files changed
  • 3 contributors

Commits on Dec 31, 2020

  1. Configuration menu
    Copy the full SHA
    3c19b97 View commit details
    Browse the repository at this point in the history
  2. Prepare rand_core 0.6.1

    taiki-e committed Dec 31, 2020
    Configuration menu
    Copy the full SHA
    a63eb3a View commit details
    Browse the repository at this point in the history
  3. Prepare rand 0.8.1

    taiki-e committed Dec 31, 2020
    Configuration menu
    Copy the full SHA
    e5eec8e View commit details
    Browse the repository at this point in the history

Commits on Jan 1, 2021

  1. Merge pull request #1081 from taiki-e/playground

    Enable all stable features in the playground
    dhardy authored Jan 1, 2021
    Configuration menu
    Copy the full SHA
    34aa769 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    eb4b8a4 View commit details
    Browse the repository at this point in the history

Commits on Jan 2, 2021

  1. Configuration menu
    Copy the full SHA
    594aed8 View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2021

  1. Merge pull request #1083 from dhardy/work

    Fix #1082 (seed_from_u64 with non multiple of 4)
    dhardy authored Jan 4, 2021
    Configuration menu
    Copy the full SHA
    bda9974 View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2021

  1. distributions/uniform: fix panic in gen_range(0..=MAX)

    This commit fixes a panic when generating a single sample in an
    inclusive range that spans the entire integer range, eg for u8:
    ```rust
    rng.gen_range(0..=u8::MAX)
    // panicked at 'attempt to add with overflow', src/distributions/uniform.rs:529:42
    ```
    [Playground example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=use%20rand%3A%3ARng%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20rand%3A%3Athread_rng().gen_range(0u8..%3D255u8)%3B%0A%7D).
    
    The cause is a discrepancy between the "single sample" and the "many
    samples" codepaths:
    ```rust
    // Ok
    UniformSampler::new_inclusive(u8::MIN, u8::MAX).sample(&mut rng);
    // Panic
    UniformSampler::sample_single_inclusive(u8::MIN, u8::MAX, &mut rng);
    ```
    In `sample`, a `range` of 0 is interpreted to mean "sample from the
    whole range".
    In `sample_range_inclusive`, no check is performed, which leads to
    overflow when computing the `ints_to_reject`.
    
    **Testing**
    - Added a test case.
    - Old code panics, new code passes.
    mautier committed Jan 12, 2021
    Configuration menu
    Copy the full SHA
    4e8c7a4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2c9085a View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2021

  1. Merge pull request #1087 from GautierMinster/fix_uniform_int_panic_on…

    …_full_inclusive_range
    
    distributions/uniform: fix panic in gen_range(0..=MAX)
    dhardy authored Jan 13, 2021
    Configuration menu
    Copy the full SHA
    6a6b9fd View commit details
    Browse the repository at this point in the history
Loading