Java Random Long nextLong(long RangeBottom, long rangeTop)

Here you can find the source of nextLong(long RangeBottom, long rangeTop)

Description

next Long

License

Open Source License

Declaration

public static long nextLong(long RangeBottom, long rangeTop) 

Method Source Code

//package com.java2s;
/*//  w  w  w.j  a  v  a 2 s  .c om
 * Copyright (c) 2014, 2016 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

import java.util.Random;

public class Main {
    private static Random rnd = new Random();

    public static long nextLong(long RangeBottom, long rangeTop) {
        return RangeBottom
                + ((long) (rnd.nextDouble() * (rangeTop - RangeBottom)));
    }
}

Related

  1. nextLong()
  2. nextLong()
  3. nextLong()
  4. nextLong(long n)
  5. nextLong(long n)
  6. nextLong(Random random, final long lower, final long upper)
  7. nextLong(Random rng, long n)
  8. nextLong(Random rng, long n)
  9. nextLongId()