random: prefer internal uniform distributions
This commit is contained in:
parent
f116422086
commit
f091e97f11
@ -10,6 +10,7 @@
|
||||
|
||||
#include "coord/traits.hpp"
|
||||
#include "rand/generic.hpp"
|
||||
#include "rand/distribution/uniform.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
@ -68,8 +69,8 @@ namespace cruft::random {
|
||||
template <typename ValueT>
|
||||
using uniform_distribution = std::conditional_t<
|
||||
std::is_floating_point<ValueT>::value,
|
||||
std::uniform_real_distribution<ValueT>,
|
||||
std::uniform_int_distribution<ValueT>
|
||||
cruft::rand::distribution::uniform_real_distribution<ValueT>,
|
||||
cruft::rand::distribution::uniform_int_distribution<ValueT>
|
||||
>;
|
||||
|
||||
|
||||
@ -197,7 +198,7 @@ namespace cruft::random {
|
||||
T*
|
||||
choose (T (&t)[N])
|
||||
{
|
||||
std::uniform_int_distribution<size_t> dist (0, N - 1);
|
||||
cruft::rand::distribution::uniform_int_distribution<size_t> dist (0, N - 1);
|
||||
return &t[dist (generator ())];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user