diff options
Diffstat (limited to 'test/com/jogamp/opencl/TestUtils.java')
-rw-r--r-- | test/com/jogamp/opencl/TestUtils.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/com/jogamp/opencl/TestUtils.java b/test/com/jogamp/opencl/TestUtils.java index e7e5fabe..87e7cc5f 100644 --- a/test/com/jogamp/opencl/TestUtils.java +++ b/test/com/jogamp/opencl/TestUtils.java @@ -62,13 +62,21 @@ public class TestUtils { Random rnd = new Random(seed); while(buffer.remaining() != 0) - buffer.put(rnd.nextFloat()); + buffer.put(rndFloat(rnd)); buffer.rewind(); return buffer; } + public static float rndFloat(Random rnd) { + return rndFloat(rnd, 100); + } + + public static float rndFloat(Random rnd, float range) { + return (rnd.nextFloat()-0.5f)*range*2; + } + public static void checkIfEqual(ByteBuffer a, ByteBuffer b, int elements) { for(int i = 0; i < elements; i++) { int aVal = a.getInt(); |