Separate random bits generator, new partition implementation, slightly changed applyrule function