From 5fcb4d2fabed164e0884d453647ce54ca4ec2c90 Mon Sep 17 00:00:00 2001 From: john01dav Date: Thu, 28 Jul 2016 21:00:53 -0500 Subject: [PATCH] Optimized prime search utility methods and added timer to FalloffPerlinNoiseTest --- .../john01dav/jnoise/tests/FalloffPerlinNoiseTest.java | 3 +++ src/src/john01dav/jnoise/util/MathUtil.java | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Tests/src/src/john01dav/jnoise/tests/FalloffPerlinNoiseTest.java b/Tests/src/src/john01dav/jnoise/tests/FalloffPerlinNoiseTest.java index dbc4796..6e86fda 100644 --- a/Tests/src/src/john01dav/jnoise/tests/FalloffPerlinNoiseTest.java +++ b/Tests/src/src/john01dav/jnoise/tests/FalloffPerlinNoiseTest.java @@ -10,8 +10,11 @@ public class FalloffPerlinNoiseTest{ public static void main(String[] args) throws IOException{ + long start = System.currentTimeMillis(); HeightMap heightMap = new HeightMap(2048, new PerlinNoiseTemplate(0L, 9, 2, new FalloffPerlinNoiseController())); heightMap.generate(); + System.out.println("Generation Time: " + (System.currentTimeMillis() - start)); + heightMap.saveImage("./falloffislandperlinnoise.png"); } diff --git a/src/src/john01dav/jnoise/util/MathUtil.java b/src/src/john01dav/jnoise/util/MathUtil.java index f59cbac..6742715 100644 --- a/src/src/john01dav/jnoise/util/MathUtil.java +++ b/src/src/john01dav/jnoise/util/MathUtil.java @@ -5,7 +5,9 @@ public final class MathUtil{ private MathUtil(){} public static boolean isPrime(int n){ - for(int i=2;i