Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions std/random.d
Original file line number Diff line number Diff line change
Expand Up @@ -2072,8 +2072,7 @@ Returns:
return a `ref` to the $(D range element), otherwise it will return
a copy.
*/
auto ref inout(ElementType!Range) choice(Range, RandomGen = Random)(inout auto ref Range range,
ref RandomGen urng)
auto ref choice(Range, RandomGen = Random)(auto ref Range range, ref RandomGen urng)
if (isRandomAccessRange!Range && hasLength!Range && isUniformRNG!RandomGen)
{
assert(range.length > 0,
Expand Down Expand Up @@ -2110,13 +2109,6 @@ auto ref choice(Range)(auto ref Range range)
"Choice did not return a valid element from the given Range");
}

@safe unittest // issue 18631
{
const a = [0,1,2];
auto r = choice(a);
auto s = choice(cast(const)[0,1,2]);
}

@safe unittest
{
import std.algorithm.searching : canFind;
Expand Down