MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / staticRandomValueFrom

Function staticRandomValueFrom

source/core/StarStaticRandom.hpp:110–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108
109template <typename Container, typename T, typename... TL>
110typename Container::value_type staticRandomValueFrom(Container const& container, T const& d, TL const&... rest) {
111 if (container.empty()) {
112 return {};
113 } else {
114 auto i = container.begin();
115 std::advance(i, staticRandomI32Range(0, container.size() - 1, d, rest...));
116 return *i;
117 }
118}
119
120template <typename T>
121class URBG {

Callers 2

itemToPlaceMethod · 0.85

Calls 4

staticRandomI32RangeFunction · 0.85
emptyMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected