Java Random Byte Array randomBytesWithEveryPossibleByteValueRepresentedAtLeastOnce()

Here you can find the source of randomBytesWithEveryPossibleByteValueRepresentedAtLeastOnce()

Description

random Bytes With Every Possible Byte Value Represented At Least Once

License

Open Source License

Declaration

public static byte[] randomBytesWithEveryPossibleByteValueRepresentedAtLeastOnce() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Random;

public class Main {
    public static byte[] randomBytesWithEveryPossibleByteValueRepresentedAtLeastOnce() {
        Random r = new Random();
        byte[] data = new byte[1024 * 1024 * 10];
        r.nextBytes(data);/*from  www  .j a v  a 2s  .c om*/

        byte next = Byte.MIN_VALUE;
        int numByteValuesPossible = (-Byte.MIN_VALUE) + Byte.MAX_VALUE;
        for (int x = 0; x < numByteValuesPossible; x++) {
            data[x] = next;
            next++;
        }

        return data;
    }
}

Related

  1. randomBytes(int size)
  2. randomBytes(long seed, int blockCount, int blockSize)
  3. randomBytes(Random r, int length)
  4. randomBytes(Random rand, int size)
  5. randomBytesSlowNextInt(Random r, byte[] buf, int from, int len)