-1

To my knowledge, they both do the same thing, which is generate a value between 0.0 and 1.0, right?

1 Answers1

1

One return a float, one return a double.

Just try this:

    Random random = new Random();
    System.out.println("nextFloat: " + random.nextFloat() + ", nextDouble: " + random.nextDouble());

that returns: nextFloat: 0.9613963, nextDouble: 0.9364254125546306

Altoz 123
  • 11
  • 2