Package java.util

Examples of java.util.Random.nextInt()


            prefixLength = random.nextInt(8000) + 1;
        } else if (random.nextBoolean()) {
            distinct = random.nextInt(16000) + 1;
            prefixLength = random.nextInt(100) + 1;
        } else {
            distinct = random.nextInt(10) + 1;
            prefixLength = random.nextInt(10) + 1;
        }
        boolean delete = random.nextBoolean();
        StringBuilder buff = new StringBuilder();
        for (int j = 0; j < prefixLength; j++) {
View Full Code Here


        } else if (random.nextBoolean()) {
            distinct = random.nextInt(16000) + 1;
            prefixLength = random.nextInt(100) + 1;
        } else {
            distinct = random.nextInt(10) + 1;
            prefixLength = random.nextInt(10) + 1;
        }
        boolean delete = random.nextBoolean();
        StringBuilder buff = new StringBuilder();
        for (int j = 0; j < prefixLength; j++) {
            buff.append("x");
View Full Code Here

            PreparedStatement prepInsert = conn.prepareStatement("INSERT INTO a VALUES(?)");
            PreparedStatement prepDelete = conn.prepareStatement("DELETE FROM a WHERE text=?");
            PreparedStatement prepDeleteAllButOne = conn.prepareStatement("DELETE FROM a WHERE text <> ?");
            int count = 0;
            for (int i = 0; i < 1000; i++) {
                int y = random.nextInt(distinct);
                try {
                    prepInsert.setString(1, prefix + y);
                    prepInsert.executeUpdate();
                    count++;
                } catch (SQLException e) {
View Full Code Here

                    } else {
                        TestBase.logError("error", e);
                        break;
                    }
                }
                if (delete && random.nextInt(10) == 1) {
                    if (random.nextInt(4) == 1) {
                        try {
                            prepDeleteAllButOne.setString(1, prefix + y);
                            int deleted = prepDeleteAllButOne.executeUpdate();
                            if (deleted < count - 1) {
View Full Code Here

                        TestBase.logError("error", e);
                        break;
                    }
                }
                if (delete && random.nextInt(10) == 1) {
                    if (random.nextInt(4) == 1) {
                        try {
                            prepDeleteAllButOne.setString(1, prefix + y);
                            int deleted = prepDeleteAllButOne.executeUpdate();
                            if (deleted < count - 1) {
                                printError(seed, "deleted:" + deleted + " i:" + i);
View Full Code Here

        Random random = new Random(0);
        int rows = 0;
        Savepoint sp = null;
        int len = getSize(100, 400);
        for (int i = 0; i < len; i++) {
            switch (random.nextInt(10)) {
            case 0:
                trace("insert");
                conn.createStatement().execute(
                        "INSERT INTO TEST(DATA, DATA2) VALUES('" + i + "' || SPACE(" + spaceLen + "), '" + i + "')");
                rows++;
View Full Code Here

                rows++;
                break;
            case 1:
                if (rows > 0) {
                    trace("delete");
                    conn.createStatement().execute("DELETE FROM TEST WHERE ID=" + random.nextInt(rows));
                }
                break;
            case 2:
                if (rows > 0) {
                    trace("update");
View Full Code Here

                break;
            case 2:
                if (rows > 0) {
                    trace("update");
                    conn.createStatement().execute(
                            "UPDATE TEST SET DATA='x' || DATA, DATA2='x' || DATA2 WHERE ID=" + random.nextInt(rows));
                }
                break;
            case 3:
                if (rows > 0) {
                    trace("commit");
View Full Code Here

        Random random = new Random(seed);
        char[] buff = new char[len];
        for (int i = 0; i < len; i++) {
            char ch;
            do {
                ch = (char) random.nextInt(Character.MAX_VALUE);
                // UTF8: String.getBytes("UTF-8") only returns 1 byte for
                // 0xd800-0xdfff
            } while (ch >= 0xd800 && ch <= 0xdfff);
            buff[i] = ch;
        }
View Full Code Here

//            new Thread(stopper).start();
            for (int i = 0; i < 2000; i++) {
                if (i == 100) {
                    System.out.println("#Running...");
                }
                if (r.nextInt(100) < 10) {
                    conn.createStatement().execute("ALTER TABLE TEST_META ALTER COLUMN ID INT DEFAULT 10");
                }
                if (r.nextBoolean()) {
                    if (r.nextBoolean()) {
                        prep.setString(1, new String(new char[r.nextInt(30) * 10]));
 
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.