Answers for "random float java nums after dot"

2

random float in java

import java.util.Random;

public static float randFloat(float min, float max) {

    Random rand = new Random();

    return rand.nextFloat() * (max - min) + min;

}
Posted by: Guest on March-16-2021
0

random float in java

Random r = new Random();
double random = min + r.nextDouble() * (max - min);
Posted by: Guest on March-16-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language