MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / Shuffle

Function Shuffle

SampleFramework12/v1.00/SF12_Math.h:491–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489}
490
491template<typename T> void Shuffle(std::vector<T>& values, Random& randomGenerator)
492{
493 const uint64 count = values.size();
494 for(uint64 i = 0; i < count; ++i)
495 {
496 uint64 other = i + (randomGenerator.RandomUint() % (count - i));
497 Swap(values[i], values[other]);
498 }
499}
500
501template<typename T> void Shuffle(T* values, uint64 count, Random& randomGenerator)
502{

Callers

nothing calls this directly

Calls 3

SwapFunction · 0.85
RandomUintMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected