Java Random Double randomDouble()

Here you can find the source of randomDouble()

Description

this method returns a random number n such that 0.0 <= n <= 1.0

License

Open Source License

Declaration

static double randomDouble() 

Method Source Code


//package com.java2s;
import java.util.Random;

public class Main {
    /**/*from   w  w  w  .  j a v a  2 s .  c om*/
     * this method returns a random number n such that
     * 0.0 <= n <= 1.0
     */
    static double randomDouble() {
        Random r = new Random();
        return r.nextInt(1000) / 1000.0;
    }
}

Related

  1. randomDouble()
  2. randomDouble()
  3. randomDouble()
  4. randomDouble()
  5. randomDouble()
  6. randomDouble(double low, double high)
  7. randomDouble(double min, double max)
  8. randomDouble(double min, double max)
  9. randomDouble(double min, double max)