added replacement flag for either static replacement or 'random' to generate a random byte