summaryrefslogtreecommitdiff
path: root/sc/source/core/opencl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-01-20 16:24:14 +0200
committerMichael Meeks <michael.meeks@collabora.com>2015-01-21 07:21:19 +0000
commitdad7161cc30b335a108c7850f453877a161969ae (patch)
treeb0b093ffe95b869a94fe3de283e33baff7254c4c /sc/source/core/opencl
parentcd5f69376bf27275d92073943451b8b72a708d04 (diff)
fdo88632: Make the Calc random functions non-random when requested
We don't want such a mode to affect other uses of randomness, though. Thus use a separate random number generator object for these two functions, and use a fixed seed for it if the SC_RAND_REPEATABLE environment variable is set. As RAND() is implemented in sc, and RANDBETWEEN() is implemented in scaddins, it was a bit hard to figure out where to add the new functions needed, without having to over-engineer things with UNO. (This functionality is totally Calc-specific, but neither sc nor scaddins has any public (non-UNO) API.) Caolan suggested the formula module, which seems like a good enough place to me. Change-Id: Ic1c9ca165278d53036598b03b13b4ffbdc98a75e Reviewed-on: https://gerrit.libreoffice.org/14053 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source/core/opencl')
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index a5648e3cef11..948b4ab1d331 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -16,7 +16,7 @@
#include "tokenarray.hxx"
#include "compiler.hxx"
#include "interpre.hxx"
-#include <comphelper/random.hxx>
+#include <formula/random.hxx>
#include <formula/vectortoken.hxx>
#include "scmatrix.hxx"
@@ -654,7 +654,7 @@ threefry2x32 (threefry2x32_ctr_t in, threefry2x32_key_t k)\n\
/// Create buffer and pass the buffer to a given kernel
virtual size_t Marshal( cl_kernel k, int argno, int, cl_program ) SAL_OVERRIDE
{
- cl_int seed = comphelper::rng::uniform_int_distribution(0, SAL_MAX_INT32);
+ cl_int seed = formula::rng::nRandom(0, SAL_MAX_INT32);
// Pass the scalar result back to the rest of the formula kernel
cl_int err = clSetKernelArg(k, argno, sizeof(cl_int), (void*)&seed);
if (CL_SUCCESS != err)