Java Random random()

Here you can find the source of random()

Description

random

License

Open Source License

Declaration

public static float random() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int random(int min, int max) {
        return (int) (min + (Math.random() * (max - min)));
    }//from  w w  w  .j a v a  2  s. c  om

    public static float random(float min, float max) {
        return (float) (min + (Math.random() * (max - min)));
    }

    public static float random() {
        return random(0f, 1f);
    }

    public static double random(double min, double max) {
        return min + (Math.random() * (max - min));
    }
}

Related

  1. rand()
  2. Rand()
  3. randAngle()
  4. randFloat(float min, float max)
  5. random()
  6. random()
  7. random()
  8. random(E[] elements)
  9. random(final char[] chars)