about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY4
-rw-r--r--generator/pgmnoise.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index cd7cedc5..04ad32f7 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -6,7 +6,9 @@ CHANGE HISTORY
 
 not yet  BJH  Release 10.45.00
 
-              pamditherbw: Fix -value other than .5 work for -fs, -atkinson.
+              pgmnoise: fix bug: never generates full white pixel.
+
+              pamditherbw: Fix -value other than .5 with -fs, -atkinson.
 
               Build: rename Makefile.common, Makefile.config, to common.mk,
               etc.
diff --git a/generator/pgmnoise.c b/generator/pgmnoise.c
index 643f260f..af65a23b 100644
--- a/generator/pgmnoise.c
+++ b/generator/pgmnoise.c
@@ -55,7 +55,7 @@ int main(int    argc,
     for (row = 0; row < rows; ++row) {
         unsigned int col;
         for (col = 0; col < cols; ++col)
-            destrow[col] = rand() % PGM_MAXMAXVAL;
+            destrow[col] = rand() % (PGM_MAXMAXVAL + 1);
 
         pgm_writepgmrow(stdout, destrow, cols, PGM_MAXMAXVAL, 0);
     }