tdf#90110: basic: fix Randomize statement

Desktop / LibreOffice - Michael Stahl [redhat.com] - 19 May 2015 15:02 UTC

- time() is used to seed the RNG but since it only has second resolution, the same values will be generated if it's called multiple times like in the bug report

- BASIC using the global rng would be fine except that BASIC Randomize takes an optional parameter to set the seed, which should continue to be supported, but should not affect the RNG state for non-BASIC users of comphelper::random

(regression from df466d79cb126667cc9d5c108367bfa4f5ce76c8, but the old implementation was even more delightfully absurd, where Randomize was essentially srand((sal_uInt16)rand()) ...)

564fc48 tdf#90110: basic: fix Randomize statement
basic/inc/pch/precompiled_sb.hxx | 2 +-
basic/source/runtime/methods.cxx | 46 ++++++++++++++++++++++++++++++++------
2 files changed, 40 insertions(+), 8 deletions(-)

Upstream: cgit.freedesktop.org


  • Share