readonly static int white = Color.White.ToArgb();
readonly static int black = Color.Black.ToArgb();
readonly static Random NoiseRnd = new Random();
private static DirectBitmap GetStaticNoise(int width, int height)
{
var bitmap = new DirectBitmap(width, height);
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
var rnd = NoiseRnd.Next(0, 2);
bitmap.SetPixel(x, y, rnd % 2 == 0 ? white : black);
}
}
return bitmap;
}
Correcting typo
(comment edited Nov 20, 2023 at 14:07)