MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / Shuffle

Function Shuffle

src/cryptlib/cryptlib.h:124–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122
123/// randomly shuffle the specified array, resulting permutation is uniformly distributed
124template <class T> void Shuffle(RandomNumberGenerator &rng, T *array, unsigned int size)
125{
126 while (--size)
127 swap(array[size], array[(unsigned int)rng.GetLong(0, size)]);
128}
129
130/// abstract base class for hash functions
131/** HashModule objects are stateful. They are created in an initial state,

Callers

nothing calls this directly

Calls 2

swapFunction · 0.85
GetLongMethod · 0.80

Tested by

no test coverage detected