mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
update random.hpp
This commit is contained in:
parent
eb760e1776
commit
dc21a8ea51
1 changed files with 4 additions and 4 deletions
|
|
@ -5,10 +5,10 @@
|
|||
#include <algorithm>
|
||||
|
||||
namespace util {
|
||||
template <class T = std::mt19937, std::size_t N = T::state_size * sizeof(typename T::result_type)>
|
||||
typename std::enable_if<N, T>::type seeded_random_engine(
|
||||
std::random_device& source
|
||||
) {
|
||||
template <
|
||||
class T = std::mt19937,
|
||||
std::size_t N = T::state_size * sizeof(typename T::result_type)>
|
||||
auto seeded_random_engine(std::random_device& source) {
|
||||
std::random_device::result_type randomData[(N - 1) / sizeof(source()) + 1];
|
||||
std::generate(std::begin(randomData), std::end(randomData), std::ref(source));
|
||||
std::seed_seq seeds(std::begin(randomData), std::end(randomData));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue