Random « float « Java Data Type Q&A





1. Random.nextFloat is not applicable for floats?    stackoverflow.com

float minX = 50.0f;
float maxX = 100.0f;

Random rand = new Random();

float finalX = rand.nextFloat(maxX - minX + 1.0f) + minX;
"The method nextFloat() in the type Random is not applicable for the ...

2. how to get a random gaussian float?    forums.oracle.com

In general if you have a number x in the range (a,b) and you apply a linear scaling x |-> c+(x-a)*(d-c)/(b-a) you'll end up with a number in the range (c,d). If a number of x-values with a given distribution are transformed in this way the resulting distribution will have a similar "shape". Care will be needed in implementing this because ...

3. Random floats    forums.oracle.com

4. Random float value    forums.oracle.com