<?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[Problem mit Zufallsgenerator]]></title><description><![CDATA[<p>Hallo,<br />
ich schreibe gerade ein Spaßprogramm, das PC-Speaker-Beeps mit zufälligen Höhen ausgibt. Nun hab ich das Problem, das die Zufallszahl immer gleich ist, oder sich nur um 1 oder 2 verändert.</p>
<p>Zuerst initialisiere ich so:</p>
<p>srand(time(NULL));</p>
<p>Dann erzeuge ich die Zufallszahl so:</p>
<p>random_number = (rand() % 1000) + 1;</p>
<p>Was ist da falsch? Bin schon am verzweifeln <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/212722/problem-mit-zufallsgenerator</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 18:53:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/212722.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 May 2008 15:30:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit Zufallsgenerator on Fri, 09 May 2008 15:30:03 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich schreibe gerade ein Spaßprogramm, das PC-Speaker-Beeps mit zufälligen Höhen ausgibt. Nun hab ich das Problem, das die Zufallszahl immer gleich ist, oder sich nur um 1 oder 2 verändert.</p>
<p>Zuerst initialisiere ich so:</p>
<p>srand(time(NULL));</p>
<p>Dann erzeuge ich die Zufallszahl so:</p>
<p>random_number = (rand() % 1000) + 1;</p>
<p>Was ist da falsch? Bin schon am verzweifeln <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1506211</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1506211</guid><dc:creator><![CDATA[Arr0ws]]></dc:creator><pubDate>Fri, 09 May 2008 15:30:03 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Zufallsgenerator on Fri, 09 May 2008 15:38:20 GMT]]></title><description><![CDATA[<p>Der Wert, den time(0) liefert, ändert sich nur einmal pro Sekunde.<br />
Wenn du den Zufallsgenerator mit der gleichen Zahl initialisierst, wird er immer die selbe Zahlenfolge generieren.<br />
Siehe dazu auch hier:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-172876.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-172876.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1506214</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1506214</guid><dc:creator><![CDATA[Nanyuki]]></dc:creator><pubDate>Fri, 09 May 2008 15:38:20 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit Zufallsgenerator on Fri, 09 May 2008 16:06:58 GMT]]></title><description><![CDATA[<p>Danke, habs geschafft.</p>
<p>Hab einfach vor der For - Schleife den Zufalls Generator Initialisiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1506221</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1506221</guid><dc:creator><![CDATA[Arr0ws]]></dc:creator><pubDate>Fri, 09 May 2008 16:06:58 GMT</pubDate></item></channel></rss>