From 134441ff830ee7b0c023145e2eb74f2bc212a9e5 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 16 Jun 2021 12:04:03 +0200 Subject: [PATCH] =?UTF-8?q?Code=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zufallszahlen.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/zufallszahlen.cpp b/zufallszahlen.cpp index eda888f..e93d99f 100644 --- a/zufallszahlen.cpp +++ b/zufallszahlen.cpp @@ -1,7 +1,17 @@ -cout << "C++11:" << endl; - random_device seed; - mt19937 engine(seed()); // Generator - uniform_int_distribution values(1, 10000); // Verteilung 1-10000 - for( size_t i=0; i < 3; ++i) { - cout << values(engine) << endl; - } \ No newline at end of file +#include +#include +#include + +using std::cout; +using std::endl; +inline void zufallszahl() +{ + cout << RAND_MAX << endl; + + srand((unsigned int) time(0)); + + for(int i=1; i<=20; i++){ + cout << rand() % 6 +1 << " "; + cout << endl; + } +}