MCPcopy Create free account
hub / github.com/davidgiven/luje / nextBytes

Method nextBytes

lib/java/util/Random.java:118–130  ·  view source on GitHub ↗

Modifies the byte array by a random sequence of bytes generated by this random number generator. @param buf non-null array to contain the new random bytes. @see #next

(byte[] buf)

Source from the content-addressed store, hash-verified

116 * @see #next
117 */
118 public void nextBytes(byte[] buf) {
119 int rand = 0, count = 0, loop = 0;
120 while (count < buf.length) {
121 if (loop == 0) {
122 rand = nextInt();
123 loop = 3;
124 } else {
125 loop--;
126 }
127 buf[count++] = (byte) rand;
128 rand >>= 8;
129 }
130 }
131
132 /**
133 * Generates a normally distributed random {@code double} number between 0.0

Callers

nothing calls this directly

Calls 1

nextIntMethod · 0.95

Tested by

no test coverage detected