Java Random Byte Array randomBytesSlowNextInt(Random r, byte[] buf, int from, int len)

Here you can find the source of randomBytesSlowNextInt(Random r, byte[] buf, int from, int len)

Description

Fill specified range of byte array with random data.

License

GNU General Public License

Declaration

static private void randomBytesSlowNextInt(Random r, byte[] buf, int from, int len) 

Method Source Code

//package com.java2s;
/* This code is part of Freenet. It is distributed under the GNU General
 * Public License, version 2 (or at your option any later version). See
 * http://www.gnu.org/ for further details of the GPL. */

import java.util.Random;

public class Main {
    /** Fill specified range of byte array with random data. */
    static private void randomBytesSlowNextInt(Random r, byte[] buf, int from, int len) {
        if (from == 0 && len == buf.length) {
            r.nextBytes(buf);/* www  .  j a  va  2 s  .  co m*/
            return;
        }
        byte[] tmp = new byte[len];
        r.nextBytes(tmp);
        System.arraycopy(tmp, 0, buf, from, len);
    }
}

Related

  1. randomBytes(int minimumCharacters, int maximumCharacters)
  2. randomBytes(int size)
  3. randomBytes(long seed, int blockCount, int blockSize)
  4. randomBytes(Random r, int length)
  5. randomBytes(Random rand, int size)
  6. randomBytesWithEveryPossibleByteValueRepresentedAtLeastOnce()