[all-commits] [llvm/llvm-project] 31dfaf: [libc++] Change requirements on linear_congruentia...

Zoe Carver via All-commits all-commits at lists.llvm.org
Tue Nov 10 18:26:39 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 31dfaff3b395a19f23bb1010bfcec67452efe02d
      https://github.com/llvm/llvm-project/commit/31dfaff3b395a19f23bb1010bfcec67452efe02d
  Author: zoecarver <z.zoelec2 at gmail.com>
  Date:   2020-11-10 (Tue, 10 Nov 2020)

  Changed paths:
    M libcxx/include/random
    A libcxx/test/std/numerics/rand/rand.eng/rand.eng.lcong/alg.pass.cpp
    A libcxx/test/std/numerics/rand/rand.eng/rand.eng.lcong/params.fail.cpp

  Log Message:
  -----------
  [libc++] Change requirements on linear_congruential_engine.

This patch changes how linear_congruential_engine picks its randomization
algorithm. It adds two restrictions, `_OverflowOK` and `_SchrageOK`.
`_OverflowOK` means that m is a power of two so using the classic
`(a * x + c) % m` will create a meaningless overflow. The second checks
that Schrage's algorithm will produce results that are in bounds of min
and max. This patch fixes https://llvm.org/PR27839.

Differential Revision: D65041




More information about the All-commits mailing list