From a784afc87d23700390e9942f9fbf56e6f9408a42 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 13 Jun 2018 12:38:13 +0200 Subject: [PATCH] STYLE: floor/truncate instead of rounding for Random::position (issue #865) - affects random integer ranges. Simpler to extend the range by one and floor (truncate) instead of rounding using odd intervals. --- applications/test/Random/Test-Random.C | 42 ++++++++++++++----- .../primitives/random/Random/Random.C | 21 ++++++++-- .../primitives/random/Random/Random.H | 20 ++++----- 3 files changed, 59 insertions(+), 24 deletions(-) diff --git a/applications/test/Random/Test-Random.C b/applications/test/Random/Test-Random.C index a724fe8357..a0635488b0 100644 --- a/applications/test/Random/Test-Random.C +++ b/applications/test/Random/Test-Random.C @@ -68,6 +68,22 @@ double randomFraction(const uint64_t bits) using namespace Foam; +// Test uniformity of random +void testPosition(const label n) +{ + List