public static byte[] newArray(final int length, final double p) {
		final byte[] bytes = newArray(length);

		Randoms.indexes(RandomRegistry.random(), length, p)
			.forEach(i -> bytes[i >>> 3] |= (byte)(1 << (i & 7)));

		return bytes;
	}
Create a new {@code byte[]} array which can store at least the number
of bits as defined by the given {@code length} parameter. The returned
byte array is initialized with ones according to the given ones
probability {@code p}.

@param length the number of bits, the returned byte array can store.
@param p the ones probability of the returned byte array.
@return the new byte array.s
@throws IllegalArgumentException if {@code p} is not a valid probability.
jenetics/src/main/java/io/jenetics/internal/util/Bits.java