updated: factor out common random byte methods.