Java Random Byte rand(int lo, int hi)

Here you can find the source of rand(int lo, int hi)

Description

rand

License

Open Source License

Declaration

private static int rand(int lo, int hi) 

Method Source Code

//package com.java2s;

public class Main {
    private static int rand(int lo, int hi) {
        java.util.Random rn = new java.util.Random();
        int n = hi - lo + 1;
        int i = rn.nextInt(n);
        if (i < 0)
            i = -i;/*  w w  w .  j  a v a  2s.  c o  m*/
        return lo + i;
    }
}

Related

  1. rand(int bit)
  2. rand(int lbound, int ubound)
  3. rand(int lo, int hi)
  4. Rand(int lo, int hi)
  5. rand(int lo, int hi)
  6. rand(int max)
  7. randByte()
  8. randomByte()