Java Random Long nextLong()

Here you can find the source of nextLong()

Description

next Long

License

LGPL

Declaration

public static double nextLong() 

Method Source Code


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

import java.util.Random;

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

    public static long nextLong(long min, long max) {
        return (long) ((random.nextDouble() * (max - min)) + min);
    }/*from w  w  w. j a  v  a  2s.c  o m*/

    public static long nextLong(long bound) {
        return (long) (random.nextDouble() * (bound));
    }

    public static double nextLong() {
        return random.nextDouble();
    }

    public static double nextDouble(double min, double max) {
        return (random.nextDouble() * (max - min)) + min;
    }

    public static double nextDouble(double bound) {
        return (random.nextDouble() * (bound));
    }

    public static long nextDouble() {
        return (long) random.nextDouble();
    }
}

Related

  1. getLongBetween(long n, long m)
  2. getLongInRange(long minValue, long maxValue)
  3. getLongSpecial()
  4. getLongSpecialCases()
  5. getRandomLong()
  6. nextLong()
  7. nextLong()
  8. nextLong(long n)
  9. nextLong(long n)