MCPcopy Create free account
hub / github.com/axmolengine/axmol / getRandomObject

Method getRandomObject

core/base/Vector.h:260–268  ·  view source on GitHub ↗

Returns a random element of the Vector. */

Source from the content-addressed store, hash-verified

258
259 /** Returns a random element of the Vector. */
260 T getRandomObject() const
261 {
262 if (!_data.empty())
263 {
264 ssize_t randIdx = RandomHelper::random_int<int>(0, static_cast<int>(_data.size()) - 1);
265 return *(_data.begin() + randIdx);
266 }
267 return nullptr;
268 }
269
270 /**
271 * Checks whether an object is in the container.

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected