<?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[C++11 kontinuierliche Normalverteilung]]></title><description><![CDATA[<p>Hallo ihr Lieben,</p>
<p>ich versuche gerade die Zufallszahlengeneratoren von C++11 zu verwenden und scheitere an der Erzeugung von kontinuierlichen Zufallszahlen:</p>
<pre><code class="language-cpp">std::random_device seed;
std::mt19937 engine;
std::normal_distribution&lt;double&gt; gauss(0.0,1.0);
std::cout &lt;&lt; gauss(engine) &lt;&lt; std::endl;
</code></pre>
<p>Was mich nun wundert: Warum sind die Zufallszahlen nicht kontinuierlich, sondern nach wie vor diskret? Ich verstehe die Beschreibung so, dass ich im Template Argument - also in den spitzen Klammern - <code>float</code> oder <code>double</code> reinschreiben soll, wenn ich kontinuierliche anstatt diskrete Zufallszahlen möchte.</p>
<p>Was übersehe ich?</p>
<p>Gruß,<br />
-- Klaus.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/322735/c-11-kontinuierliche-normalverteilung</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 16:49:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/322735.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Jan 2014 20:30:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++11 kontinuierliche Normalverteilung on Sat, 04 Jan 2014 20:30:03 GMT]]></title><description><![CDATA[<p>Hallo ihr Lieben,</p>
<p>ich versuche gerade die Zufallszahlengeneratoren von C++11 zu verwenden und scheitere an der Erzeugung von kontinuierlichen Zufallszahlen:</p>
<pre><code class="language-cpp">std::random_device seed;
std::mt19937 engine;
std::normal_distribution&lt;double&gt; gauss(0.0,1.0);
std::cout &lt;&lt; gauss(engine) &lt;&lt; std::endl;
</code></pre>
<p>Was mich nun wundert: Warum sind die Zufallszahlen nicht kontinuierlich, sondern nach wie vor diskret? Ich verstehe die Beschreibung so, dass ich im Template Argument - also in den spitzen Klammern - <code>float</code> oder <code>double</code> reinschreiben soll, wenn ich kontinuierliche anstatt diskrete Zufallszahlen möchte.</p>
<p>Was übersehe ich?</p>
<p>Gruß,<br />
-- Klaus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2375143</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2375143</guid><dc:creator><![CDATA[Klaus82]]></dc:creator><pubDate>Sat, 04 Jan 2014 20:30:03 GMT</pubDate></item><item><title><![CDATA[Reply to C++11 kontinuierliche Normalverteilung on Sat, 04 Jan 2014 20:44:39 GMT]]></title><description><![CDATA[<p>Klaus82 schrieb:</p>
<blockquote>
<p>Was mich nun wundert: Warum sind die Zufallszahlen nicht kontinuierlich, sondern nach wie vor diskret?</p>
</blockquote>
<p>Was meinst du damit?</p>
<p>Bei mir kommen mit</p>
<pre><code class="language-cpp">int main()
{
  std::random_device seed;
  std::mt19937 engine;
  std::normal_distribution&lt;double&gt; gauss(0.0,1.0);
  for (int i=0; i&lt;100; ++i)
    std::cout &lt;&lt; gauss(engine) &lt;&lt; std::flush &lt;&lt; std::endl
              &lt;&lt; std::flush &lt;&lt; std::flush &lt;&lt; std::flush &lt;&lt; std::flush;
}
</code></pre>
<p>schöne Kommazahlen raus.</p>
<pre><code>0.13453
-0.146382
0.46065
-1.87138
0.163712
-0.214253
0.298595
-0.827944
0.0102154
1.05547
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2375147</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2375147</guid><dc:creator><![CDATA[bahnhof11]]></dc:creator><pubDate>Sat, 04 Jan 2014 20:44:39 GMT</pubDate></item><item><title><![CDATA[Reply to C++11 kontinuierliche Normalverteilung on Sun, 05 Jan 2014 00:42:41 GMT]]></title><description><![CDATA[<p>Sicher dass die letzten 4 flushes auch wirklich nötig waren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2375148</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2375148</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Sun, 05 Jan 2014 00:42:41 GMT</pubDate></item><item><title><![CDATA[Reply to C++11 kontinuierliche Normalverteilung on Sat, 04 Jan 2014 20:49:07 GMT]]></title><description><![CDATA[<p>Argh!</p>
<p>Ja, du hast recht.</p>
<p>Ich hatte das Problem, dass mein return Type der Funktion noch auf <code>int</code> eingestellt war.</p>
<p>Asche auf mein Haupt! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /></p>
<p>Gruß,<br />
-- Klaus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2375151</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2375151</guid><dc:creator><![CDATA[Klaus82]]></dc:creator><pubDate>Sat, 04 Jan 2014 20:49:07 GMT</pubDate></item><item><title><![CDATA[Reply to C++11 kontinuierliche Normalverteilung on Sun, 05 Jan 2014 00:42:31 GMT]]></title><description><![CDATA[<p>Du erstellst zwar eine random_engine zum seeden, benutzt sie dann aber nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2375164</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2375164</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Sun, 05 Jan 2014 00:42:31 GMT</pubDate></item></channel></rss>