diff --git a/include/ircd/rand.h b/include/ircd/rand.h index 8259a32f9..f2eb89c5a 100644 --- a/include/ircd/rand.h +++ b/include/ircd/rand.h @@ -41,6 +41,11 @@ namespace ircd::rand template<> u256x1 vector() noexcept; template<> u512x1 vector() noexcept; + // Random vector over distribution + template + T vector(distribution &); + // Random fill of buffer const_buffer fill(const mutable_buffer &out) noexcept; @@ -98,6 +103,23 @@ noexcept return dict[pos]; } +template +inline T +ircd::rand::vector(distribution &dist) +{ + constexpr auto lanes + { + simd::lanes() + }; + + T ret; + for(unsigned i(0); i < lanes; ++i) + ret[i] = dist(mt); + + return ret; +} + inline ircd::rand::xoshiro256p::xoshiro256p() noexcept