Skip to content

Commit 30ee421

Browse files
committed
Replace usage of rand() with a comment
1 parent ff905d6 commit 30ee421

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/include/ImageDitherColor.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ uint8_t Image::findClosestPalette(int16_t r, int16_t g, int16_t b)
7777
}
7878
}
7979

80-
return contenderList[contenderCount <= 1 ? 0 : rand() % contenderCount];
80+
// If your project has a good way to seed rand(),
81+
// you can use rand() here to improve dithering quality
82+
// when using shades that are exactly between palette colors.
83+
//return contenderList[contenderCount <= 1 ? 0 : rand() % contenderCount];
84+
85+
return contenderList[0];
8186
}
8287

8388
/**

0 commit comments

Comments
 (0)