function for adding noise