<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.stephanschlegel.de/index.php?action=history&amp;feed=atom&amp;title=Java_-_Zufallszahlen</id>
	<title>Java - Zufallszahlen - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.stephanschlegel.de/index.php?action=history&amp;feed=atom&amp;title=Java_-_Zufallszahlen"/>
	<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=Java_-_Zufallszahlen&amp;action=history"/>
	<updated>2026-05-07T03:01:15Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Wikizone</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.stephanschlegel.de/index.php?title=Java_-_Zufallszahlen&amp;diff=19766&amp;oldid=prev</id>
		<title>134.3.241.116: Die Seite wurde neu angelegt: „Quelle: http://blog.root-of-all-evil.com/2010/03/math-random-zufallszahlen-in-java/   == Zufallszahlen zwischen &gt;=0 und &lt;1  [0,1] ==  &lt;pre&gt; 	public static double …“</title>
		<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=Java_-_Zufallszahlen&amp;diff=19766&amp;oldid=prev"/>
		<updated>2013-03-18T15:50:41Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „Quelle: http://blog.root-of-all-evil.com/2010/03/math-random-zufallszahlen-in-java/   == Zufallszahlen zwischen &amp;gt;=0 und &amp;lt;1  [0,1] ==  &amp;lt;pre&amp;gt; 	public static double …“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Quelle: http://blog.root-of-all-evil.com/2010/03/math-random-zufallszahlen-in-java/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Zufallszahlen zwischen &amp;gt;=0 und &amp;lt;1  [0,1] ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	public static double myRandom() {&lt;br /&gt;
		return Math.random();&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Zufallszahlen zwischen &amp;gt;=0 und &amp;lt;n [0,n] ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	public static double myRandom(double high) {&lt;br /&gt;
		return Math.random() * high;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ausgabe von myRandom(3) z.B.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1.6597912671200072&lt;br /&gt;
0.741373630031203&lt;br /&gt;
2.657789140634944&lt;br /&gt;
1.4622900147468707&lt;br /&gt;
2.4057227757910007&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Zufallszahlen zwischen &amp;gt;=x und &amp;lt;y, also [x,y] ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	public static double myRandom(double low, double high) {&lt;br /&gt;
		return Math.random() * (high - low) + low;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Ganzzahlige (Integer) Zufallszahlen ==&lt;br /&gt;
&lt;br /&gt;
Um ganzzahlige Zufallszahlen zu erstellen ist ein &amp;#039;&amp;#039;&amp;#039;Cast&amp;#039;&amp;#039;&amp;#039; mit Hilfe von (int) notwendig.&lt;br /&gt;
&lt;br /&gt;
Ganzzahlige Zufallszahlen zwischen &amp;gt;=x und &amp;lt;y, also [x,y[&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	public static int myRandom(int low, int high) {&lt;br /&gt;
		return (int) (Math.random() * (high - low) + low);&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ausgabe von myRandom(2,5) z.B.:&lt;br /&gt;
3 4 2 2 3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Zufallszahlen inklusive Obergrenze ==&lt;br /&gt;
&lt;br /&gt;
Soll der high-value auch noch mitaufgenommen werden, hilft dieser kleine Trick:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	public static int myRandomWithHigh(int low, int high) {&lt;br /&gt;
		high++;&lt;br /&gt;
		return (int) (Math.random() * (high - low) + low);&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Nun ist auch die 5 erhalten; Ausgabe von myRandomWithHigh(2,5) z.B.:&lt;br /&gt;
 4 3 5 2 2&lt;/div&gt;</summary>
		<author><name>134.3.241.116</name></author>
	</entry>
</feed>