choice

fnauto ref choice(Range, RandomGen = Random)(Range range, ref RandomGen urng) if (isRandomAccessRange!Range && hasLength!Range && isUniformRNG!RandomGen)

Returns a random, uniformly chosen, element e from the supplied

Range range. If no random number generator is passed, the default

rndGen is used.

Parameters

rangea random access range that has the length property defined
urng(optional) random number generator to use; if not specified, defaults to rndGen

Returns

A single random element drawn from the range. If it can, it will

return a ref to the range element, otherwise it will return a copy.

fnauto ref choice(Range)(Range range)

ditto

fnauto ref choice(Range, RandomGen = Random)(ref Range range, ref RandomGen urng) if (isRandomAccessRange!Range && hasLength!Range && isUniformRNG!RandomGen)

ditto

fnauto ref choice(Range)(ref Range range)

ditto