[Issue 15202] New: filter and randomCover do not work together

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Oct 14 05:46:55 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=15202

          Issue ID: 15202
           Summary: filter and randomCover do not work together
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: ryan at rcorre.net

---
  int val = [1,2,3]
    .randomCover
    .filter!(x => x > 99)
    .front;
---

I would expect that to fail -- there is no element greater than 99.
Instead, it randomly retrieves one of the 3 values, ignoring the filter.

--


More information about the Digitalmars-d-bugs mailing list