Skip to content

Commit

Permalink
RandomSample should check if input is InputRange.
Browse files Browse the repository at this point in the history
  • Loading branch information
WebDrake committed May 4, 2012
1 parent 56ef139 commit 40a79b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion std/random.d
Expand Up @@ -1487,7 +1487,7 @@ a sample of size $(D n) in O(n) steps and requiring O(n) random
variates, regardless of the size of the data being sampled.
*/
struct RandomSample(R, Random = void)
if(isUniformRNG!Random || is(Random == void))
if(isInputRange!R && (isUniformRNG!Random || is(Random == void)))
{
private size_t _available, _toSelect;
private immutable ushort _alphaInverse = 13; // Vitter's recommended value.
Expand Down

0 comments on commit 40a79b3

Please sign in to comment.