View source code
Display the source code in std/random.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.random.randomShuffle
Shuffles elements of
using r
as a shuffler. gen
must be
a random-access range with length. If no RNG is specified, r
will be used.
rndGen
Prototypes
void randomShuffle(Range, RandomGen)( Range r, RandomGen gen ) if (isRandomAccessRange!Range && isUniformRNG!RandomGen); void randomShuffle(Range)( Range r ) if (isRandomAccessRange!Range);
Parameters
Name | Description |
---|---|
r | random-access range whose elements are to be shuffled |
gen | (optional) random number generator to use; if not
specified, defaults to
|
Authors
Andrei Alexandrescu
Masahiro Nakagawa (Xorshift
random generator)
Joseph Rushton Wakeling (Algorithm D for random sampling)