Java Utililty Methods Random Byte

List of utility methods to do Random Byte

Description

The list of methods to do Random Byte are organized into topic(s).

Method

bytecreateRandomByte()
create Random Byte
return (byte) (Math.random() * 255);
bytegenerateRandomByte()
generate Random Byte
return (byte) (Math.random() * 0xFF);
Stringrand(int bit)
rand
if (bit < 1) {
    return "";
Random random = new Random();
Double randNumber = random.nextDouble();
return randNumber.toString().split("\\.")[1].substring(0, bit);
intrand(int lbound, int ubound)
rand
return (int) ((rand.nextDouble() * (ubound - lbound + 1)) + lbound);
intrand(int lo, int hi)
rand
int n = hi - lo + 1;
int i = rn.nextInt() % n;
if (i < 0) {
    i = -i;
return lo + i;
intrand(int lo, int hi)
rand
java.util.Random rn = new java.util.Random();
int n = hi - lo + 1;
int i = rn.nextInt(n);
if (i < 0)
    i = -i;
return lo + i;
intrand(int lo, int hi)
Returns a random number that falls within the specified range
int n = hi - lo + 1;
int i = rn.nextInt() % n;
if (i < 0) {
    i = -i;
return lo + i;
intRand(int lo, int hi)
Returns an integer random number uniformly distributed between lo and hi .
Random rn2 = new Random();
int n = hi - lo + 1;
int i = rn2.nextInt(n);
if (i < 0) {
    i = -i;
return lo + i;
intrand(int max)
Get a random integer less than a given value.
return randomSet.nextInt(max);
byterandByte()
rand Byte
return (byte) ((int) (Math.random() * s_RAND_MAX) & 0xff);