Java Random randomFloat(float min, float max)

Here you can find the source of randomFloat(float min, float max)

Description

random Float

License

Open Source License

Declaration

public static float randomFloat(float min, float max) 

Method Source Code

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

public class Main {
    public static float randomFloat(float min, float max) {
        return (float) (Math.random() * (max - min) + min);
    }//from ww  w .java2 s .c om

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

Related

  1. randomEnum(Class clazz)
  2. randomEvent(float theChance, float theRange)
  3. randomException()
  4. randomFailure()
  5. randomFloat(float aVal)
  6. randomFloatBetween(float begin, float end)
  7. randomFromIterator(Iterator iter)
  8. randomGaussian(int numElements)
  9. randomGreyLevels(double max, double min)