var noise = new hxd.Perlin();
noise.normalize = true;
var scale = 32.0;
var bmpData = new hxd.BitmapData(64, 64);
for (y in 0...bmpData.height) {
for (x in 0...bmpData.width) {
var noiseValue = noise.perlin(0, x / scale, y / scale, 2);
var grayScaleColor = Math.round((noiseValue + 1) / 2 * 255);
var color = (0xFF << 24) | (grayScaleColor << 16) | (grayScaleColor << 8) | grayScaleColor;
bmpData.setPixel(x, y, color);
}
}
var bmp = new h2d.Bitmap(h2d.Tile.fromBitmap(bmpData), s2d);