From 6bc2c1fb456be62b8548e16c40c674bb1ef34149 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 27 Mar 2021 22:22:12 +0100 Subject: [PATCH] Small fix. --- 02_math_osztaly.txt | 4 ++-- 02_math_osztaly/math.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/02_math_osztaly.txt b/02_math_osztaly.txt index ec9e829..baa531d 100644 --- a/02_math_osztaly.txt +++ b/02_math_osztaly.txt @@ -148,8 +148,8 @@ UML: | + randomize() { static } | -> srand(time(NULL)); | | | + rand() : int { static } | -> return rand(); -| + randf() : float { static } | -> return rand() / RANDOM_32BIT_MAX; -| + randd() : float { static } | -> return rand() / RANDOM_32BIT_MAX; +| + randf() : float { static } | -> return rand() / static_cast(RANDOM_32BIT_MAX); +| + randd() : double { static } | -> return rand() / static_cast(RANDOM_32BIT_MAX); | | | + rand(int m) : int { static } | -> return rand() % m; | | diff --git a/02_math_osztaly/math.cpp b/02_math_osztaly/math.cpp index 38c3885..22a219a 100644 --- a/02_math_osztaly/math.cpp +++ b/02_math_osztaly/math.cpp @@ -48,11 +48,11 @@ int Math::rand() { } float Math::randf() { - return rand() / RANDOM_32BIT_MAX; + return rand() / static_cast(RANDOM_32BIT_MAX); } double Math::randd() { - return rand() / RANDOM_32BIT_MAX; + return rand() / static_cast(RANDOM_32BIT_MAX); } int rand(const int m) {