<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Zufallszahlen]]></title><description><![CDATA[<p>Hallo ich brauche für ein Würfelspiel einen zufallszahlen generator für die zahlen 1-6 und einmal für die Zahlen 1-3</p>
<p>Kann mir jemand da vielleicht Quellcode schicken</p>
<p>int Zahlengenerator (int zahl)<br />
{<br />
int Zahl1;</p>
<p>srand(time(NULL));<br />
Zahl1 = (rand() % 6) + 1;</p>
<p>return Zahl1;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/101844/zufallszahlen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 03:01:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/101844.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 20 Feb 2005 11:55:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zufallszahlen on Sun, 20 Feb 2005 11:55:04 GMT]]></title><description><![CDATA[<p>Hallo ich brauche für ein Würfelspiel einen zufallszahlen generator für die zahlen 1-6 und einmal für die Zahlen 1-3</p>
<p>Kann mir jemand da vielleicht Quellcode schicken</p>
<p>int Zahlengenerator (int zahl)<br />
{<br />
int Zahl1;</p>
<p>srand(time(NULL));<br />
Zahl1 = (rand() % 6) + 1;</p>
<p>return Zahl1;<br />
}</p>
]]></description><link>https://www.c-plusplus.net/forum/post/727842</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/727842</guid><dc:creator><![CDATA[m0p3d]]></dc:creator><pubDate>Sun, 20 Feb 2005 11:55:04 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahlen on Sun, 20 Feb 2005 12:03:24 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>- srand() nur einmal pro Programm aufrufen<br />
- statt %6 einfach %3</p>
<p>was willst du denn noch mehr Code?<br />
bist du sicher, das du im richtigen Forum bist?</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/727849</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/727849</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 20 Feb 2005 12:03:24 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahlen on Sun, 20 Feb 2005 12:19:11 GMT]]></title><description><![CDATA[<p>Jap und wie mach ich das am besten ich muss ja dann eigentlich das Programm neu starten , oder wie erreiche ich das sonst ......</p>
]]></description><link>https://www.c-plusplus.net/forum/post/727864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/727864</guid><dc:creator><![CDATA[m0p3d]]></dc:creator><pubDate>Sun, 20 Feb 2005 12:19:11 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahlen on Sun, 20 Feb 2005 12:42:03 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>srand() rufst du im Konstruktor des Hauptforms auf und entfernst es aus Zahlengenerator().<br />
Dann kannst du Zahlengenerator() so oft aufrufen, wie du willst.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/727897</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/727897</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 20 Feb 2005 12:42:03 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahlen on Sun, 20 Feb 2005 14:53:10 GMT]]></title><description><![CDATA[<p>Alternativ kannst du auch die Unit &quot;math&quot; einbinden,<br />
und mit</p>
<pre><code class="language-cpp">Randomize()
</code></pre>
<p>den Zufallsgenerator initialisieren und mit</p>
<pre><code class="language-cpp">int zahl  = RandomRange(1,6);
int zahl2 = RandomRange(1,3);
</code></pre>
<p>deine Zufallszahlen generieren</p>
<p>MfG,<br />
MastaFlasH</p>
]]></description><link>https://www.c-plusplus.net/forum/post/728028</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/728028</guid><dc:creator><![CDATA[MastaFlasH]]></dc:creator><pubDate>Sun, 20 Feb 2005 14:53:10 GMT</pubDate></item></channel></rss>