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) {