Java Random Byte rand(int lbound, int ubound)

Here you can find the source of rand(int lbound, int ubound)

Description

rand

License

Open Source License

Declaration

public static int rand(int lbound, int ubound) 

Method Source Code


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

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

    public static int rand(int lbound, int ubound) {
        return (int) ((rand.nextDouble() * (ubound - lbound + 1)) + lbound);
    }//from w w  w  .ja  v  a2 s. c om

    public static double nextDouble() {
        return rand.nextDouble();
    }
}

Related

  1. createRandomByte()
  2. generateRandomByte()
  3. rand(int bit)
  4. rand(int lo, int hi)
  5. rand(int lo, int hi)
  6. rand(int lo, int hi)
  7. Rand(int lo, int hi)