Improved code.

This commit is contained in:
Christian P. MOMON 2020-09-19 03:51:59 +02:00
parent 512e20fb32
commit 7683a5c58f

View file

@ -100,9 +100,6 @@ public class CatGenerator
}
else
{
// Initialize the random generator.
Random generator = new Random(Integer.parseInt(DigestUtils.md5Hex(seed).substring(0, 6), 16));
// Create an empty image.
result = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
Graphics2D grapher = result.createGraphics();
@ -110,6 +107,8 @@ public class CatGenerator
grapher.clearRect(0, 0, 256, 256);
// Add stuff.
// Initialize the random generator.
Random generator = new Random(Integer.parseInt(DigestUtils.md5Hex(seed).substring(0, 6), 16));
drawImage(grapher, "body", generator.nextInt(15) + 1);
drawImage(grapher, "fur", generator.nextInt(10) + 1);
drawImage(grapher, "eyes", generator.nextInt(15) + 1);