Ensured Random::Range does not overflow 10/157210/1
authorDavid Steele <david.steele@samsung.com>
Mon, 23 Oct 2017 18:08:00 +0000 (19:08 +0100)
committerDavid Steele <david.steele@samsung.com>
Mon, 23 Oct 2017 18:08:00 +0000 (19:08 +0100)
commit6b1ba02982113dbfe6c8975ffed4ecc91b6db54e
tree0861d4dbe05dedd3019a690ad5c925e454b5857a
parenteb50f6431c862445b4eb5e9a0eed48e743f297c3
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>
dali/public-api/math/random.h