From c5e0f0980ead7245488dced4a2d16da3a32e59e8 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:09:43 +0100 Subject: [PATCH] function generiereZufallszahl --- src/main/c/Mathe.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 87183e0..c095d30 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -47,6 +47,23 @@ void zeigeAuswahl(const char* text); void initialisiereZufallsgenerator() { srand(time(NULL)); } +//18 +int generiereZufallszahl(int min, int max) { + return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); +} + + + + + + + + + + + + +