From df15a33e1035d47c223e83ecd4018e392c851969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 7 Jun 2021 22:34:33 +0200 Subject: [PATCH] Fix numeric conversion warnings in example --- examples/heightmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/heightmap.c b/examples/heightmap.c index 13a3c1e1..988dd0b8 100644 --- a/examples/heightmap.c +++ b/examples/heightmap.c @@ -292,12 +292,12 @@ static void generate_heightmap__circle(float* center_x, float* center_y, { float sign; /* random value for element in between [0-1.0] */ - *center_x = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); - *center_y = (MAP_SIZE * rand()) / (1.0f * RAND_MAX); - *size = (MAX_CIRCLE_SIZE * rand()) / (1.0f * RAND_MAX); - sign = (1.0f * rand()) / (1.0f * RAND_MAX); + *center_x = (MAP_SIZE * rand()) / (float) RAND_MAX; + *center_y = (MAP_SIZE * rand()) / (float) RAND_MAX; + *size = (MAX_CIRCLE_SIZE * rand()) / (float) RAND_MAX; + sign = (1.0f * rand()) / (float) RAND_MAX; sign = (sign < DISPLACEMENT_SIGN_LIMIT) ? -1.0f : 1.0f; - *displacement = (sign * (MAX_DISPLACEMENT * rand())) / (1.0f * RAND_MAX); + *displacement = (sign * (MAX_DISPLACEMENT * rand())) / (float) RAND_MAX; } /* Run the specified number of iterations of the generation process for the