Add random mask function.