Java Random randomFloat(float aVal)

Here you can find the source of randomFloat(float aVal)

Description

Returns a random float up to given value.

License

Open Source License

Declaration

public static float randomFloat(float aVal) 

Method Source Code


//package com.java2s;

import java.util.*;

public class Main {
    static Random _random = new Random();

    /**/*w w  w. j a  v a2  s  .  c om*/
     * Returns a random float up to given value.
     */
    public static float randomFloat(float aVal) {
        return Math.abs(_random.nextInt()) / (float) Integer.MAX_VALUE * aVal;
    }
}

Related

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