private static byte[] mutate(byte[] in, int len, double probability, long position) throws IOException { byte[] ret = in; if (Math.abs(Util.getRnd()) < probability) { if (len > 2) { write(" Mutating byte at position " + position); double rnd = Math.abs(Util.getRnd()); int l = (int) (Math.abs(Util.getRnd()) * len); if (rnd < 0.3333333) { write(" " + l + " bytes will be removed"); len -= l; } else if (rnd > 0.66666666) { write(" " + l + " byte will be added"); len += l; } ret = mutate(in, len); } } return ret; }
protected synchronized String buildNewOwnerId(String role) { return role + "#" + Util.getRndLong(); }