Skip to content

c++17 removed random_shuffle #24010

Closed
@hoodmane

Description

@hoodmane

std::random_shuffle is used here:
https://github.com/matplotlib/matplotlib/blob/main/src/tri/_tri.cpp#L1469

It has been removed from c++17:
https://en.cppreference.com/w/cpp/algorithm/random_shuffle

The reason for removing std::random_shuffle in C++17 is that the iterator-only version usually depends on std::rand, which is now also discussed for deprecation. (std::rand should be replaced with the classes of the header, as std::rand is considered harmful.) In addition, the iterator-only std::random_shuffle version usually depends on a global state. The std::shuffle's shuffle algorithm is the preferred replacement, as it uses a URBG as its 3rd parameter.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions