Add choose implementation for fixed size arrays
This commit is contained in:
parent
c3a268b2c3
commit
d6c0a821f4
@ -43,6 +43,12 @@ namespace util {
|
||||
return *cursor;
|
||||
}
|
||||
|
||||
template <typename T, size_t N>
|
||||
T&
|
||||
choose (T (&v)[N]) {
|
||||
return v[static_cast<size_t> (random<float> () * N)];
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename T::value_type&
|
||||
choose (T begin, T end) {
|
||||
|
Loading…
Reference in New Issue
Block a user