Java Random Double randomDouble()

Here you can find the source of randomDouble()

Description

random Double

License

Apache License

Declaration

public static double randomDouble() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Random;

public class Main {
    private static final Random random = new Random();

    public static double randomDouble() {
        return random.nextDouble();
    }//from   w w w  .  j  av a  2s . c o  m

    public static double randomDouble(double min, double max) {
        if (min > max) {
            double m = min;
            max = min;
            min = m;
        }
        return min + (random.nextDouble() * (max - min));
    }
}

Related

  1. randomBoth(double range)
  2. randomChance(double chance)
  3. randomColor(double d)
  4. randomDouble()
  5. randomDouble()
  6. randomDouble()
  7. randomDouble()
  8. randomDouble()
  9. randomDouble()