Bug ID: 77994
           Summary: std::sample uses incorrect integer types internally
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot
          Reporter: gcc-bugzilla at contacts dot
  Target Milestone: ---

Both the reservoir sampling and the selection sampling implementations use a
uniform_int_distribution<_Size> to generate integers distributed over the
population size, but _Size is merely the type of the user-supplied argument
specifying the desired selection size, and that type may not be large enough to
represent integers distributed over the population size.

The selection sampling implementation also uses _Size for __unsampled_sz, which
is incorrect for the same reason.

Reply via email to