BUG: expressions rand() ignores objectRegistry timeIndex (fixes #2923)

This commit is contained in:
Mark Olesen 2023-06-26 17:44:37 +02:00
parent 20c7f0970d
commit 095c9bc45b

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -41,9 +41,11 @@ void Foam::expressions::exprDriver::fill_random
{ {
if (seed <= 0) if (seed <= 0)
{ {
if (timeStatePtr_) const TimeState* ts = this->timeState();
if (ts)
{ {
seed = (timeStatePtr_->timeIndex() - seed); seed = (ts->timeIndex() - seed);
} }
else else
{ {