www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15202] New: filter and randomCover do not work together

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 puremagic.com
          Reporter: ryan 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.

--
Oct 14 2015