random: materialise the offset temporary for container choose
This helps a little in some debugging situations and isn't terrifically expensive.
This commit is contained in:
parent
98705a61c9
commit
9a8679c733
10
random.hpp
10
random.hpp
@ -165,9 +165,11 @@ namespace cruft::random {
|
||||
if (data.empty ())
|
||||
return data.end ();
|
||||
|
||||
return std::next (
|
||||
data.begin (),
|
||||
uniform (typename ContainerT::size_type {0}, data.size () - 1)
|
||||
auto const offset = uniform (
|
||||
typename ContainerT::size_type {0},
|
||||
data.size () - 1
|
||||
);
|
||||
|
||||
return std::next (data.begin (), offset);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user