http://d.puremagic.com/issues/show_bug.cgi?id=10265

           Summary: RandomSample fails when passed an InputRange as input
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Joseph Rushton Wakeling <[email protected]> 
2013-06-04 06:23:21 PDT ---
By design, RandomSample is supposed to operate on any InputRange:

    struct RandomSample(R, Random = void)
        if(isInputRange!R && (isUniformRNG!Random || is(Random == void)))

However, RandomSample itself is designed to be a ForwardRange with save()
defined.  The save property in turn assumes that the input has save() defined:

    @property typeof(this) save()
    {
        auto ret = this;
        ret._input = _input.save;
        return ret;
    }

The assumption that RandomSample can have save() defined is also problematic
for a second reason: the output from the saved copy will depend on random
numbers, and therefore will not be identical, so it is not clear what the
benefit of a save() function is.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to