<?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[probleme mit Zufallszahlen]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich erstelle mit srand( (unsigned) time(0) ) ; und</p>
<pre><code class="language-cpp">m_ZufallsTest = rand() % 100 + 1;
</code></pre>
<p>Zufallszahlen. Problem: Der Wert ändert sich, aber meist erst nach 40 Aufrufen. Ich rufe diese Zeile in einer While(true)-Schleife auf und erhalte so z.B. folgende Werte</p>
<p>40<br />
40<br />
40<br />
40<br />
40<br />
40<br />
76<br />
76<br />
76<br />
76<br />
13<br />
13<br />
13</p>
<p>usw. Weiß wer woran das liegt?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/221713/probleme-mit-zufallszahlen</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 19:43:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/221713.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 02 Sep 2008 11:09:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to probleme mit Zufallszahlen on Tue, 02 Sep 2008 11:09:14 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich erstelle mit srand( (unsigned) time(0) ) ; und</p>
<pre><code class="language-cpp">m_ZufallsTest = rand() % 100 + 1;
</code></pre>
<p>Zufallszahlen. Problem: Der Wert ändert sich, aber meist erst nach 40 Aufrufen. Ich rufe diese Zeile in einer While(true)-Schleife auf und erhalte so z.B. folgende Werte</p>
<p>40<br />
40<br />
40<br />
40<br />
40<br />
40<br />
76<br />
76<br />
76<br />
76<br />
13<br />
13<br />
13</p>
<p>usw. Weiß wer woran das liegt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575253</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575253</guid><dc:creator><![CDATA[mühundnot]]></dc:creator><pubDate>Tue, 02 Sep 2008 11:09:14 GMT</pubDate></item><item><title><![CDATA[Reply to probleme mit Zufallszahlen on Tue, 02 Sep 2008 11:10:43 GMT]]></title><description><![CDATA[<p>Rufst du auch immer wieder srand( (unsigned) time(0) ) ; auf? Einmal ist nämlich genug.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575255</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575255</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Tue, 02 Sep 2008 11:10:43 GMT</pubDate></item><item><title><![CDATA[Reply to probleme mit Zufallszahlen on Tue, 02 Sep 2008 11:15:26 GMT]]></title><description><![CDATA[<p>Fellhuhn schrieb:</p>
<blockquote>
<p>Rufst du auch immer wieder srand( (unsigned) time(0) ) ; auf? Einmal ist nämlich genug.</p>
</blockquote>
<p>Zuerst wollte ich &quot;Nein&quot; schreiben, hab aber nochmal genau hingeschaut: Das war (wenn auch schwer ersichtlich) tatsächlich der Fehler. Thx!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575259</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575259</guid><dc:creator><![CDATA[jdk208]]></dc:creator><pubDate>Tue, 02 Sep 2008 11:15:26 GMT</pubDate></item><item><title><![CDATA[Reply to probleme mit Zufallszahlen on Tue, 02 Sep 2008 20:07:10 GMT]]></title><description><![CDATA[<p>Hier sei mal noch die random Bibliothke von boost erwähnt:</p>
<p><a href="http://www.boost.org/doc/libs/1_36_0/libs/random/index.html" rel="nofollow">http://www.boost.org/doc/libs/1_36_0/libs/random/index.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1575563</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1575563</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Tue, 02 Sep 2008 20:07:10 GMT</pubDate></item></channel></rss>