Examples of nextInt()


Examples of java.util.Random.nextInt()

        // select randomized
        Random random = new Random(1);
        time = System.currentTimeMillis();
        prep = conn.prepareStatement("SELECT * FROM TEST WHERE ID = ?");
        for (int i = 0; i < len; i++) {
            prep.setInt(1, random.nextInt(len));
            ResultSet rs = prep.executeQuery();
            rs.next();
            assertFalse(rs.next());
            if (i % 50000 == 0) {
                trace("  " + (100 * i / len) + "%");
View Full Code Here

Examples of java.util.Random.nextInt()

            String s = "bcdfghklmnprstwz";
            char c = s.charAt(rnd.nextInt(s.length()));
            buff.append(i == 0 ? Character.toUpperCase(c) : c);
            s = "aeiou  ";

            buff.append(s.charAt(rnd.nextInt(s.length())));
        }
        return buff.toString();
    }

    private static synchronized int getNextCustomerId() {
View Full Code Here

Examples of java.util.Random.nextInt()

    private void testRandom() {
        int len = getSize(1000, 10000);
        Random random = new Random(10);
        for (int i = 0; i < len; i++) {
            int l = random.nextInt(10);
            String[] sql = new String[l];
            StringBuilder buff = new StringBuilder();
            for (int j = 0; j < l; j++) {
                sql[j] = randomStatement(random);
                buff.append(sql[j]);
View Full Code Here

Examples of java.util.Random.nextInt()

        long v = Integer.MAX_VALUE | ((long) Integer.MAX_VALUE << 31L);
        assertEquals(v, m.interleave(Integer.MAX_VALUE, Integer.MAX_VALUE));
        assertEquals(v, m.interleave(new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE }));
        Random random = new Random(1);
        for (int i = 0; i < 1000; i++) {
            int x = random.nextInt(Integer.MAX_VALUE), y = random.nextInt(Integer.MAX_VALUE);
            v = m.interleave(new int[] {x, y});
            long v2 = m.interleave(x, y);
            assertEquals(v, v2);
            int x1 = m.deinterleave(2, v, 0);
            int y1 = m.deinterleave(2, v, 1);
View Full Code Here

Examples of java.util.Random.nextInt()

        long v = Integer.MAX_VALUE | ((long) Integer.MAX_VALUE << 31L);
        assertEquals(v, m.interleave(Integer.MAX_VALUE, Integer.MAX_VALUE));
        assertEquals(v, m.interleave(new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE }));
        Random random = new Random(1);
        for (int i = 0; i < 1000; i++) {
            int x = random.nextInt(Integer.MAX_VALUE), y = random.nextInt(Integer.MAX_VALUE);
            v = m.interleave(new int[] {x, y});
            long v2 = m.interleave(x, y);
            assertEquals(v, v2);
            int x1 = m.deinterleave(2, v, 0);
            int y1 = m.deinterleave(2, v, 1);
View Full Code Here

Examples of java.util.Random.nextInt()

            int y1 = m.deinterleave(2, v, 1);
            assertEquals(x, x1);
            assertEquals(y, y1);
        }
        for (int i = 0; i < 1000; i++) {
            int x = random.nextInt(1000), y = random.nextInt(1000), z = random.nextInt(1000);
            MultiDimension tool = MultiDimension.getInstance();
            long xyz = tool.interleave(new int[] { x, y, z });
            assertEquals(x, tool.deinterleave(3, xyz, 0));
            assertEquals(y, tool.deinterleave(3, xyz, 1));
            assertEquals(z, tool.deinterleave(3, xyz, 2));
View Full Code Here

Examples of java.util.Random.nextInt()

            int y1 = m.deinterleave(2, v, 1);
            assertEquals(x, x1);
            assertEquals(y, y1);
        }
        for (int i = 0; i < 1000; i++) {
            int x = random.nextInt(1000), y = random.nextInt(1000), z = random.nextInt(1000);
            MultiDimension tool = MultiDimension.getInstance();
            long xyz = tool.interleave(new int[] { x, y, z });
            assertEquals(x, tool.deinterleave(3, xyz, 0));
            assertEquals(y, tool.deinterleave(3, xyz, 1));
            assertEquals(z, tool.deinterleave(3, xyz, 2));
View Full Code Here

Examples of java.util.Random.nextInt()

            int y1 = m.deinterleave(2, v, 1);
            assertEquals(x, x1);
            assertEquals(y, y1);
        }
        for (int i = 0; i < 1000; i++) {
            int x = random.nextInt(1000), y = random.nextInt(1000), z = random.nextInt(1000);
            MultiDimension tool = MultiDimension.getInstance();
            long xyz = tool.interleave(new int[] { x, y, z });
            assertEquals(x, tool.deinterleave(3, xyz, 0));
            assertEquals(y, tool.deinterleave(3, xyz, 1));
            assertEquals(z, tool.deinterleave(3, xyz, 2));
View Full Code Here

Examples of java.util.Random.nextInt()

        PreparedStatement prepMulti = conn.prepareStatement(sql);
        long timeMulti = 0, timeRegular = 0;
        int timeMax = getSize(500, 2000);
        Random rand = new Random(1);
        for (int i = 0; timeMulti < timeMax; i++) {
            int size = rand.nextInt(max / 10);
            int minX = rand.nextInt(max - size);
            int minY = rand.nextInt(max - size);
            int maxX = minX + size, maxY = minY + size;
            time = System.currentTimeMillis();
            ResultSet rs1 = multi.getResult(prepMulti, new int[] { minX, minY }, new int[] { maxX, maxY });
View Full Code Here

Examples of java.util.Random.nextInt()

        long timeMulti = 0, timeRegular = 0;
        int timeMax = getSize(500, 2000);
        Random rand = new Random(1);
        for (int i = 0; timeMulti < timeMax; i++) {
            int size = rand.nextInt(max / 10);
            int minX = rand.nextInt(max - size);
            int minY = rand.nextInt(max - size);
            int maxX = minX + size, maxY = minY + size;
            time = System.currentTimeMillis();
            ResultSet rs1 = multi.getResult(prepMulti, new int[] { minX, minY }, new int[] { maxX, maxY });
            timeMulti += System.currentTimeMillis() - time;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.