jasmineRepo / JAS-mine-core

JAS-mine maintains and develops the JAS simulation platform, a discrete-event tool-kit for agent-based and dynamic microsimulation modelling. This repository contains the core libraries. See www.jas-mine.net for more details.
2 stars 5 forks source link

RNG behaviour #26

Open vkhodygo opened 2 years ago

vkhodygo commented 2 years ago

SimulationEngine.getRnd().nextDouble() generates numbers in [0, 1), not in [0, 1], which is not suitable for probabilities. This affects at least AbstractSortByDifferenceAlignment.

See also https://stackoverflow.com/questions/3680637/generate-a-random-double-in-a-range and https://stackoverflow.com/questions/58920019/java-math-random-closed-double-interval

UPD. SBDLAlignment relies on the values, provided by this rng. Since the formula used is log(1 / r - 1) we potentially get division by zero or cases of log(0).