https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88935

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>:

https://gcc.gnu.org/g:125bab23ad75449333983c9389898c5b92b3aa0d

commit r15-3129-g125bab23ad75449333983c9389898c5b92b3aa0d
Author: Giovanni Bajo <ra...@develer.com>
Date:   Wed Jul 31 20:03:40 2024 +0100

    libstdc++: Fix std::random_shuffle for low RAND_MAX [PR88935]

    When RAND_MAX is small and the number of elements being shuffled is
    close to it, we get very uneven distributions in std::random_shuffle.

    This uses a simple xorshift generator seeded by std::rand if we can't
    rely on std::rand itself.

    libstdc++-v3/ChangeLog:

            PR libstdc++/88935
            * include/bits/stl_algo.h (random_shuffle) [RAND_MAX < INT_MAX]:
            Use xorshift instead of rand().
            * testsuite/25_algorithms/random_shuffle/88935.cc: New test.

    Co-authored-by: Jonathan Wakely <jwak...@redhat.com>
    Signed-off-by: Giovanni Bajo <ra...@develer.com>
  • [Bug libstdc++/88935] std::rand... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to