Used to get a completely(-1.0F - 1.0F) random float. - Java java.util

Java examples for java.util:Random

Description

Used to get a completely(-1.0F - 1.0F) random float.

Demo Code


//package com.java2s;
import java.util.Random;

public class Main {
    /**/*from   ww w.  ja v a2 s. c  om*/
     * Used to get a completely(-1.0F - 1.0F) random float.
     * @version From DummyCore 1.0
     * @param rand - the Random, that will randomise this.
     * @return a random Float
     */
    public static float randomFloat(Random rand) {
        return rand.nextFloat() - rand.nextFloat();
    }
}

Related Tutorials