public void generateNewPatch(PatchBasket library) { this.library = library; try { Patch father = getRandomPatch(); Driver drv = (Driver)father.getDriver(); byte[] sysex = new byte[father.sysex.length]; p = new Patch(sysex, drv); ErrorMsg.reportStatus("num : " + father.sysex.length + ", " + sysex.length); for (int i = 0; i < father.sysex.length; i++) { Patch source;  do { source = getRandomPatch(); } while (source.getDriver() != drv || source.sysex.length <= i); p.sysex[i] = source.sysex[i]; } ErrorMsg.reportStatus("patch : " + father + ", " + p); p.calculateChecksum(); } catch (Exception e) { ErrorMsg.reportError("Error", "Internal Error", e); }
void generateNewPatch(PatchBasket library) { lib = library.getPatchCollection(); libSize = lib.size();    IPatch base = getRandomPatch(); ErrorMsg.reportStatus("base : " + base); int sysexSize = (base.getByteArray()).length; ErrorMsg.reportStatus("length : " + sysexSize); IDriver drv = (IDriver) base.getDriver();  byte[] dsysex = new byte[sysexSize]; dsysex[0] = (byte) SysexMessage.SYSTEM_EXCLUSIVE; for (int i = 1; i < sysexSize - 1; i++) { IPatch source; byte[] ssysex;  do { source = getRandomPatch(); ssysex = source.getByteArray(); } while (source.getDriver() != drv || ssysex.length - 1 < i); dsysex[i] = ssysex[i]; } dsysex[dsysex.length - 1] = (byte) ShortMessage.END_OF_EXCLUSIVE;  patch = (drv.createPatch(dsysex))[0]; ErrorMsg.reportStatus("done : " + patch);
    public void generateNewPatch(PatchBasket library) {        this.library = library;        try {	    Patch father = getRandomPatch();	    Driver drv = (Driver)father.getDriver();	    byte[] sysex = new byte[father.sysex.length];	    p = new Patch(sysex, drv);	    ErrorMsg.reportStatus("num : " + father.sysex.length + ", " + sysex.length);	    for (int i = 0; i < father.sysex.length; i++) {		Patch source;		// look for a patch with same Driver and enough length		do {		    source = getRandomPatch();		} while (source.getDriver() != drv || source.sysex.length <= i);		p.sysex[i] = source.sysex[i];	    }	    ErrorMsg.reportStatus("patch : " + father + ", " + p);	    p.calculateChecksum();	} catch (Exception e) {	    ErrorMsg.reportError("Error", "Internal Error", e);	}    }