Examples of nextBoolean()


Examples of java.util.Random.nextBoolean()

        Random random = new Random(1);
        for (int i = 0; i < 100; i++) {
            int len = random.nextInt(10);
            StringBuilder buff = new StringBuilder();
            for (int j = 0; j < len; j++) {
                if (random.nextBoolean()) {
                    buff.append((char) random.nextInt(0x3000));
                } else {
                    buff.append((char) random.nextInt(255));
                }
            }
View Full Code Here

Examples of java.util.Random.nextBoolean()

        Random random = new Random(1);
        for (int i = 0; i < 1000; i++) {
            int len = random.nextInt(10);
            StringBuilder buff = new StringBuilder();
            for (int j = 0; j < len; j++) {
                if (random.nextBoolean()) {
                    buff.append((char) random.nextInt(0x3000));
                } else {
                    buff.append((char) random.nextInt(255));
                }
            }
View Full Code Here

Examples of java.util.Random.nextBoolean()

                // 20% large insert, delete, or update
                if (tables.size() > 0) {
                    Connection conn = connections.get(random.nextInt(connections.size()));
                    Statement stat = conn.createStatement();
                    String table = tables.get(random.nextInt(tables.size()));
                    if (random.nextBoolean()) {
                        // 10% insert
                        stat.execute("INSERT INTO " + table + "(NAME) SELECT 'Hello ' || X FROM SYSTEM_RANGE(0, 20)");
                    } else if (random.nextBoolean()) {
                        // 5% update
                        stat.execute("UPDATE " + table + " SET NAME='Hallo Welt'");
View Full Code Here

Examples of java.util.Random.nextBoolean()

                    Statement stat = conn.createStatement();
                    String table = tables.get(random.nextInt(tables.size()));
                    if (random.nextBoolean()) {
                        // 10% insert
                        stat.execute("INSERT INTO " + table + "(NAME) SELECT 'Hello ' || X FROM SYSTEM_RANGE(0, 20)");
                    } else if (random.nextBoolean()) {
                        // 5% update
                        stat.execute("UPDATE " + table + " SET NAME='Hallo Welt'");
                    } else {
                        // 5% delete
                        stat.execute("DELETE FROM " + table);
View Full Code Here

Examples of java.util.Random.nextBoolean()

                // 5% truncate or drop table
                if (tables.size() > 0) {
                    Connection conn = connections.get(random.nextInt(connections.size()));
                    Statement stat = conn.createStatement();
                    String table = tables.get(random.nextInt(tables.size()));
                    if (random.nextBoolean()) {
                        stat.execute("TRUNCATE TABLE " + table);
                    } else {
                        stat.execute("DROP TABLE " + table);
                        tables.remove(table);
                    }
View Full Code Here

Examples of java.util.Random.nextBoolean()

        for (int i = 0; i < 10; i++) {
            conn2 = getConnection(url, getUser(), getPassword());
            list.add(conn2);
            stat2 = conn.createStatement();
            conn2.setAutoCommit(false);
            if (r.nextBoolean()) {
                stat2.execute("update test set id = id where id = " + r.nextInt(100));
            } else {
                stat2.execute("delete from test where id = " + r.nextInt(100));
            }
        }
View Full Code Here

Examples of java.util.Random.nextBoolean()

                start = now;
            }
            int x;
            x = random.nextInt(100);
            stat.execute("drop table if exists test" + x);
            String type = random.nextBoolean() ? "temp" : "";
            // String type = "";
            stat.execute("create " + type + " table test" + x + "(id int primary key, name varchar)");
            if (random.nextBoolean()) {
                stat.execute("create index idx_" + x + " on test" + x + "(name, id)");
            }
View Full Code Here

Examples of java.util.Random.nextBoolean()

            x = random.nextInt(100);
            stat.execute("drop table if exists test" + x);
            String type = random.nextBoolean() ? "temp" : "";
            // String type = "";
            stat.execute("create " + type + " table test" + x + "(id int primary key, name varchar)");
            if (random.nextBoolean()) {
                stat.execute("create index idx_" + x + " on test" + x + "(name, id)");
            }
            if (random.nextBoolean()) {
                stat.execute("insert into test" + x + " select x, x from system_range(1, " + random.nextInt(100) + ")");
            }
View Full Code Here

Examples of java.util.Random.nextBoolean()

            // String type = "";
            stat.execute("create " + type + " table test" + x + "(id int primary key, name varchar)");
            if (random.nextBoolean()) {
                stat.execute("create index idx_" + x + " on test" + x + "(name, id)");
            }
            if (random.nextBoolean()) {
                stat.execute("insert into test" + x + " select x, x from system_range(1, " + random.nextInt(100) + ")");
            }
            if (random.nextInt(10) == 1) {
                conn.close();
                conn = DriverManager.getConnection(url, "sa", "sa");
View Full Code Here

Examples of java.util.Random.nextBoolean()

        Random random = new Random(1);
        s1.execute("CREATE TABLE TEST(ID INT IDENTITY, NAME VARCHAR)");
        Statement s;
        Connection c;
        for (int i = 0; i < 1000; i++) {
            if (random.nextBoolean()) {
                s = s1;
                c = c1;
            } else {
                s = s2;
                c = c2;
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.