diff --git a/CImg.h b/CImg.h
index 344754ce0e129473cfe2112793a1e8bb6dee1f31..6e5303be90f694b14f96455ebf4d43f36c948092 100644
--- a/CImg.h
+++ b/CImg.h
@@ -27485,7 +27485,7 @@ namespace cimg_library_suffixed {
       case 2 : { // Salt & Pepper noise
         if (nsigma<0) nsigma = -nsigma;
         if (M==m) {
-          if (cimg::type<T>::is_float()) { m = (Tfloat)0; M = (Tfloat)1; }
+          if (cimg::type<T>::is_float()) { --m; ++M; }
           else { m = (Tfloat)cimg::type<T>::min(); M = (Tfloat)cimg::type<T>::max(); }
         }
         cimg_rof(*this,ptrd,T) if (cimg::rand(100)<nsigma) *ptrd = (T)(cimg::rand()<0.5?M:m);