Java Random randFloat(float min, float max)

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

Description

rand Float

License

Apache License

Parameter

Parameter Description
min The lower bound of the range (inclusive).
max The upper bound of the range (inclusive).

Return

A random floating point value within the range given.

Declaration

public static float randFloat(float min, float max) 

Method Source Code

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

public class Main {
    /**// ww  w  . ja  va  2 s.com
     * @param min The lower bound of the range (inclusive).
     * @param max The upper bound of the range (inclusive).
     * @return A random floating point value within the range given.
     */
    public static float randFloat(float min, float max) {
        return (float) (min + Math.random() * ((1 + max) - min));
    }
}

Related

  1. multSample(Random rng, double[] vals, double normsum)
  2. permute(Object[] arr, Random random)
  3. rand()
  4. Rand()
  5. randAngle()
  6. random()
  7. random()
  8. random()
  9. random()