Android Random Double Create randomDouble()

Here you can find the source of randomDouble()

Description

Returns a random double in the range 0.0 (inclusive) and 1.0 (exclusive).

License

Open Source License

Return

A uniformly distributed random double between 0.0 (inclusive) and 1.0 (exclusive)

Declaration

public static double randomDouble() 

Method Source Code

//package com.java2s;
/*/* w w  w  .j a va2 s  .  c  o m*/
 * Myro/Java license - GPL
 * 
 * Myro/Java is a Java implementation of the Myro API, defined by the Institute for Robots in
 * Education (IPRE).  See http://wiki.roboteducation.org for more information.
 * 
 * Copyright 2010-2011 Douglas Harms dharms@depauw.edu
 * 
 * This file is part of Myro/Java.
 * 
 * Myro/Java is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * 
 * Myro/Java is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Myro/Java.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.Random;

public class Main {
    private static Random _randomSeq;

    /**
     * Returns a random double in the range 0.0 (inclusive) and 1.0 (exclusive).
     * 
     * @return A uniformly distributed random double between 0.0 (inclusive) and 1.0 (exclusive)
     */
    public static double randomDouble() {
        return _randomSeq.nextDouble();
    }
}

Related

  1. getRandom(double from, double to)