Android Random Byte Array getRandomByte()

Here you can find the source of getRandomByte()

Description

get Random Byte

Declaration

public static byte getRandomByte() 

Method Source Code

//package com.java2s;

import java.util.Random;
import android.util.Log;

public class Main {

    public static byte getRandomByte() {

        byte randomNum = 0;

        Random random = new Random();
        int num = Math.abs(random.nextInt() % 256);
        randomNum = (byte) num;
        Log.d("", "--> getRandomNum num : " + num + "  ,  randomNum : "
                + (randomNum & 0xFF));
        return randomNum;
    }/*from  w  ww  . java 2 s.c  o m*/
}

Related

  1. fillRandomBytes(byte[] bytes)
  2. getRandomByteArrays(int arrSize)
  3. randomInt(int min, int max)
  4. randomStr(int length)
  5. randomStr(int length)