Package java.security

Examples of java.security.SecureRandom.nextInt()


        db.runWriteTransaction(new ISqlJetTransaction() {
            public Object run(SqlJetDb db) throws SqlJetException {

                try {
                    t.insert(rnd.nextInt(2048), blob);
                } catch (SqlJetException e) {
                    if (!SqlJetErrorCode.CONSTRAINT.equals(e.getErrorCode())) {
                        throw e;
                    }
                }
View Full Code Here


                    if (!c.eof()) {
                        do {
                            rnd.nextBytes(blob);

                            try {
                                c.update(rnd.nextInt(2048), blob);
                            } catch (SqlJetException e) {
                                if (!SqlJetErrorCode.CONSTRAINT.equals(e.getErrorCode())) {
                                    throw e;
                                }
                            }
View Full Code Here

        db.commit();

        SecureRandom rnd = new SecureRandom();
        ISqlJetTable table = db.getTable("tiles");
        for (int i = 0; i < INSERTS_COUNT; i++) {
            byte[] blob = new byte[1024 + rnd.nextInt(4096)];
            rnd.nextBytes(blob);

            int x = rnd.nextInt(2048);
            int y = 0;
            int zoom = 10;
View Full Code Here

        ISqlJetTable table = db.getTable("tiles");
        for (int i = 0; i < INSERTS_COUNT; i++) {
            byte[] blob = new byte[1024 + rnd.nextInt(4096)];
            rnd.nextBytes(blob);

            int x = rnd.nextInt(2048);
            int y = 0;
            int zoom = 10;
            db.beginTransaction(SqlJetTransactionMode.WRITE);
            try {
                table.insert(x, y, zoom, 0, blob);
View Full Code Here

            }
            catch (Exception e)
            {
                if (logger.isLoggable(MLevel.INFO))
                    logger.log(MLevel.INFO, "Failed to get local InetAddress for VMID. This is unlikely to matter. At all. We'll add some extra randomness", e);
                dos.write( srand.nextInt() );
            }
            dos.writeLong(System.currentTimeMillis());
            dos.write( srand.nextInt() );
           
            int remainder = baos.size() % 4; //if it wasn't a 4 byte inet address
View Full Code Here

                if (logger.isLoggable(MLevel.INFO))
                    logger.log(MLevel.INFO, "Failed to get local InetAddress for VMID. This is unlikely to matter. At all. We'll add some extra randomness", e);
                dos.write( srand.nextInt() );
            }
            dos.writeLong(System.currentTimeMillis());
            dos.write( srand.nextInt() );
           
            int remainder = baos.size() % 4; //if it wasn't a 4 byte inet address
            if (remainder > 0)
            {
                int pad = 4 - remainder;
View Full Code Here

      for (int j = 0; j < 1; j++) {
        for (int i = 0; i < duration.days() + 1; i++) {
          DateTime calendar = start;
          calendar = calendar.plusDays(i).withHourOfDay(
              6 + random.nextInt(10));

          Event event = new Event();
          int id = (int) (j * duration.days() + i);
          event.setId("" + id);
          event.setTitle(title + (1 + i));
View Full Code Here

          Event event = new Event();
          int id = (int) (j * duration.days() + i);
          event.setId("" + id);
          event.setTitle(title + (1 + i));
          event.setStart(calendar);
          calendar = calendar.plusHours(random.nextInt(8));
          event.setEnd(calendar);

          events.put(id, event);
        }
      }
View Full Code Here

          String key = "abc" + (rnd.nextDouble() * iterations);
          keys.add(key);
          map.put(key, new BufferedWebResponse(null));

          int randomMax = keys.size() - 1;
          int toRemove = randomMax == 0 ? 0 : rnd.nextInt(randomMax);
          String key2 = keys.get(toRemove);
          map.remove(key2);
        }
        endLatch.countDown();
      }
View Full Code Here

            // Nothing works - use platform default
            result = new SecureRandom();
        }

        // Force seeding to take place
        result.nextInt();

        long t2=System.currentTimeMillis();
        if( (t2-t1) > 100 )
            log.info(sm.getString("sessionIdGeneratorBase.createRandom",
                    result.getAlgorithm(), Long.valueOf(t2-t1)));
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.