Java Random Byte Array nextBytes(int length)

Here you can find the source of nextBytes(int length)

Description

next Bytes

License

Open Source License

Declaration

public static byte[] nextBytes(int length) 

Method Source Code

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

import java.util.Random;

public class Main {
    private static final Random randomInstance = new Random();

    public static byte[] nextBytes(int length) {
        Random r = getInstance();
        byte[] buf = new byte[length];
        r.nextBytes(buf);/*  w ww .  j  a v a 2 s  . com*/
        return buf;
    }

    public static Random getInstance() {
        return randomInstance;
    }
}

Related

  1. getRandomBytes()
  2. getRandomBytes(int size)
  3. getRandomBytes(int size)
  4. nextBytes(byte[] bytes)
  5. nextBytes(int count)
  6. randBytes(int length)
  7. randomByte(byte[] b)
  8. randomByteArray(int length)
  9. randomBytes()