[4.0] Ensured Random::Range does not overflow 38/158538/1
authorDavid Steele <david.steele@samsung.com>
Mon, 23 Oct 2017 18:08:00 +0000 (19:08 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 1 Nov 2017 17:48:16 +0000 (17:48 +0000)
commita1faee0cfd3bd434ec0eb1d36498b6361cabeea2
treedf1a4a146a02b97b749e42cd2ebdfd214eb5a8e2
parentfe9281eabb5eac57989db507d7d3d1fa80c1eeca
[4.0] Ensured Random::Range does not overflow

If rand() & 0xfff is equal to 0xfff, then the range computation would
overflow past max value due to float inaccuracy.

Changed the order of terms to prevent overflow (whilst retaining
compile time division).

Change-Id: I286e0b5c31438f32f59e53dc7a8745745369d16e
Signed-off-by: David Steele <david.steele@samsung.com>
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
dali/public-api/math/random.h