implemented random masks