From 111abda38c79ae2b2ce34323f9d94c4aad8e0990 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 30 Jan 2025 16:19:59 -0500 Subject: [PATCH] Update docs and performance --- doc/generator_defs.qbk | 3 +++ doc/generators.qbk | 8 ++++++++ performance/random_speed.cpp | 3 +++ 3 files changed, 14 insertions(+) diff --git a/doc/generator_defs.qbk b/doc/generator_defs.qbk index 73f6d58..861ac83 100644 --- a/doc/generator_defs.qbk +++ b/doc/generator_defs.qbk @@ -42,3 +42,6 @@ [template xoshiro512pp_speed[] 133%] [template xoshiro512d_speed[] 144%] [template xoshiro512mm_speed[] 113%] +[template xoshiro128pp_speed[] 133%] +[template xoshiro128f_speed[] 145%] +[template xoshiro128mm_speed[] 116%] diff --git a/doc/generators.qbk b/doc/generators.qbk index 72d6df0..5e7000b 100644 --- a/doc/generators.qbk +++ b/doc/generators.qbk @@ -90,6 +90,10 @@ numbers mean faster random number generation. [[__xoshiro512pp] [2[sup 512] [`8*sizeof(uint64_t)`] [[xoshiro512pp_speed]] [[xoshiro512++ from https://prng.di.unimi.it]] [[__xoshiro512d] [2[sup 512] [`8*sizeof(uint64_t)`] [[xoshiro512d_speed]] [[This generator returns doubles instead of uint64_t. It is modified xoshiro512+ from https://prng.di.unimi.it]] [[__xoshiro512mm] [2[sup 512] [`8*sizeof(uint64_t)`] [[xoshiro512mm_speed]] [[xoshiro512** from https://prng.di.unimi.it]] + [[__xoshiro128pp] [2[sup 128] [`4*sizeof(uint32_t)`] [[xoshiro128pp_speed]] [[xoshiro128++ from https://prng.di.unimi.it. Returns uint32_t]] + [[__xoshiro128d] [2[sup 128] [`4*sizeof(uint32_t)`] [[xoshiro128d_speed]] [[This generator returns float instead of uint32_t. It is modified xoshiro128+ from https://prng.di.unimi.it]] + [[__xoshiro128mm] [2[sup 128] [`4*sizeof(uint32_t)`] [[xoshiro128mm_speed]] [[xoshiro128** from https://prng.di.unimi.it. Returns uint32_t]] + ] As observable from the table, there is generally a quality/performance/memory @@ -104,6 +108,10 @@ If the names of the generators don't ring any bell and you have no idea which generator to use, it is reasonable to employ __xoshiro256pp for a start: It is fast and of high quality. +If you need a 32-bit return instead of 64-bit prefer __xoshiro128pp. + +If you need either double or float as the return type prefer __xoshiro256d or __xoshiro128f respectively. + [note These random number generators are not intended for use in applications where non-deterministic random numbers are required. See __random_device for a choice of (hopefully) non-deterministic random number generators.] diff --git a/performance/random_speed.cpp b/performance/random_speed.cpp index 1038605..7f51e4c 100644 --- a/performance/random_speed.cpp +++ b/performance/random_speed.cpp @@ -388,6 +388,9 @@ int main(int argc, char*argv[]) run(iter, "xoshiro512pp", boost::random::xoshiro512pp()); run(iter, "xoshiro512d", boost::random::xoshiro512d()); run(iter, "xoshiro512mm", boost::random::xoshiro512mm()); + run(iter, "xoshiro128pp", boost::random::xoshiro128pp()); + run(iter, "xoshiro128f", boost::random::xoshiro128f()); + run(iter, "xoshiro128mm", boost::random::xoshiro128mm()); #ifdef HAVE_MT19937INT_C // requires the original mt19937int.c