<?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[Zufallszahl von 0, 1 auf -1, 1]]></title><description><![CDATA[<p>Hi, ich möchte eine Zufallszahl die entweder 0 oder 1 ist auf -1 oder 1 umrechnen möglichst ohne if-else, ich kannte da mal was, hab es aber wieder vergessen.</p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/318057/zufallszahl-von-0-1-auf-1-1</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 21:39:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/318057.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 29 Jun 2013 11:18:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zufallszahl von 0, 1 auf -1, 1 on Sat, 29 Jun 2013 11:18:55 GMT]]></title><description><![CDATA[<p>Hi, ich möchte eine Zufallszahl die entweder 0 oder 1 ist auf -1 oder 1 umrechnen möglichst ohne if-else, ich kannte da mal was, hab es aber wieder vergessen.</p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335202</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335202</guid><dc:creator><![CDATA[FragenderUser]]></dc:creator><pubDate>Sat, 29 Jun 2013 11:18:55 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahl von 0, 1 auf -1, 1 on Sat, 29 Jun 2013 11:26:00 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>( Zufallszahl * 2 ) - 1 dürfte die Lösung sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335205</guid><dc:creator><![CDATA[Boolshit]]></dc:creator><pubDate>Sat, 29 Jun 2013 11:26:00 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahl von 0, 1 auf -1, 1 on Sat, 29 Jun 2013 11:46:45 GMT]]></title><description><![CDATA[<p>Das ist gut.</p>
<p>Die Frage, die sich mir hier jedoch bei stellt:</p>
<p>Wieso hast du das vor?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335213</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335213</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Sat, 29 Jun 2013 11:46:45 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahl von 0, 1 auf -1, 1 on Sat, 29 Jun 2013 12:18:11 GMT]]></title><description><![CDATA[<p>Danke.<br />
Benötige Spin up oder Spin down, die sind numal -1 bzw. 1.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335221</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335221</guid><dc:creator><![CDATA[FragenderUser]]></dc:creator><pubDate>Sat, 29 Jun 2013 12:18:11 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahl von 0, 1 auf -1, 1 on Sat, 29 Jun 2013 14:37:09 GMT]]></title><description><![CDATA[<p>Dass man öfters mal eine Zufallszahl aus einer Menge von 2 Zuständen braucht sehe ich ein. Aber warum willst da kein if einbauen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335268</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335268</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Sat, 29 Jun 2013 14:37:09 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahl von 0, 1 auf -1, 1 on Sat, 29 Jun 2013 16:20:17 GMT]]></title><description><![CDATA[<p>Alternativen, die mir noch einfallen:</p>
<pre><code>Zufallszahl ? -1 : 1
</code></pre>
<p>oder</p>
<pre><code>const int blub[2] = {-1, 1};
blub[Zufallszahl]
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2335295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335295</guid><dc:creator><![CDATA[Ramanujan]]></dc:creator><pubDate>Sat, 29 Jun 2013 16:20:17 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahl von 0, 1 auf -1, 1 on Sat, 29 Jun 2013 16:42:14 GMT]]></title><description><![CDATA[<p>Ramanujan schrieb:</p>
<blockquote>
<p>Alternativen, die mir noch einfallen:</p>
</blockquote>
<p>Die gehen auch allgemein von z=0,1 auf a,b.</p>
<p>Dazu noch:</p>
<pre><code class="language-cpp">a + z*(b-a)
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2335301</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335301</guid><dc:creator><![CDATA[gffdas]]></dc:creator><pubDate>Sat, 29 Jun 2013 16:42:14 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahl von 0, 1 auf -1, 1 on Sat, 29 Jun 2013 18:29:59 GMT]]></title><description><![CDATA[<p>Wollte eine Zeile einsparen, die erste Lösung von Ramanujan gefällt mir am besten, einzeiler + gut lesbar.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335327</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335327</guid><dc:creator><![CDATA[FragenderUser]]></dc:creator><pubDate>Sat, 29 Jun 2013 18:29:59 GMT</pubDate></item><item><title><![CDATA[Reply to Zufallszahl von 0, 1 auf -1, 1 on Sat, 29 Jun 2013 18:51:02 GMT]]></title><description><![CDATA[<p>FragenderUser schrieb:</p>
<blockquote>
<p>Wollte eine Zeile einsparen, die erste Lösung von Ramanujan gefällt mir am besten, einzeiler + gut lesbar.</p>
</blockquote>
<p>Oh? Ich dachte, du willst so einen eleganten Weg?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2335334</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2335334</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sat, 29 Jun 2013 18:51:02 GMT</pubDate></item></channel></rss>