Android Random Byte Array fillRandomBytes(byte[] bytes)

Here you can find the source of fillRandomBytes(byte[] bytes)

Description

fill Random Bytes

Declaration

public static final void fillRandomBytes(byte[] bytes) 

Method Source Code

//package com.java2s;

import java.util.Random;

public class Main {
    public static final void fillRandomBytes(byte[] bytes) {
        Random ran = new Random();
        for (int i = 0; i < bytes.length; ++i) {
            if (i > 0 && i % 120 == 0) {
                bytes[i] = '\n';
            } else {
                bytes[i] = (byte) (ran.nextInt(10) + 48);
            }/*from   ww  w .j  a  va 2 s  .  co m*/
        }
    }
}

Related

  1. getRandomByte()
  2. getRandomByteArrays(int arrSize)
  3. randomInt(int min, int max)
  4. randomStr(int length)