double min = ...
double max = ...
double value = min + (max - min) * Math.random();
Vielleicht hättest Du besser selbst das F*cking Manual lesen sollen. :roll:Roar hat gesagt.:wozu umständlich wenns schon fertige methoden gibt?![]()
Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
Returns:
a pseudorandom, uniformly distributed int value between 0 (inclusive) and n (exclusive).
Beni hat gesagt.:Returns:
a pseudorandom, uniformly distributed int value between 0 (inclusive) and n (exclusive).
0 != 1
Das wurde sogar mathematisch bewiesen (füllt aber ein ganzes Buch). :wink:
int i = new Random().nextInt(51);
i = i==0 ? 1 : i;