Improved code.
This commit is contained in:
parent
512e20fb32
commit
7683a5c58f
1 changed files with 2 additions and 3 deletions
|
@ -100,9 +100,6 @@ public class CatGenerator
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Initialize the random generator.
|
|
||||||
Random generator = new Random(Integer.parseInt(DigestUtils.md5Hex(seed).substring(0, 6), 16));
|
|
||||||
|
|
||||||
// Create an empty image.
|
// Create an empty image.
|
||||||
result = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
|
result = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
|
||||||
Graphics2D grapher = result.createGraphics();
|
Graphics2D grapher = result.createGraphics();
|
||||||
|
@ -110,6 +107,8 @@ public class CatGenerator
|
||||||
grapher.clearRect(0, 0, 256, 256);
|
grapher.clearRect(0, 0, 256, 256);
|
||||||
|
|
||||||
// Add stuff.
|
// 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, "body", generator.nextInt(15) + 1);
|
||||||
drawImage(grapher, "fur", generator.nextInt(10) + 1);
|
drawImage(grapher, "fur", generator.nextInt(10) + 1);
|
||||||
drawImage(grapher, "eyes", generator.nextInt(15) + 1);
|
drawImage(grapher, "eyes", generator.nextInt(15) + 1);
|
||||||
|
|
Loading…
Reference in a new issue