Package java.util

Examples of java.util.Random.nextBytes()


                file.close();
                mem = null;
                file = null;
            } else if ((x -= 20) < 0) {
                if (buffFile.length > 16) {
                    random.nextBytes(buffFile);
                    System.arraycopy(buffFile, 0, buffMem, 0, buffFile.length);
                    int off = random.nextInt(buffFile.length - 16);
                    int l = random.nextInt((buffFile.length - off) / 16) * 16;
                    trace("write " + off + " " + l);
                    mem.write(buffMem, off, l);
View Full Code Here


        PreparedStatement prep = conn.prepareStatement("insert into lob values(?, ?)");
        Random r = new Random(1);
        byte[] buff = new byte[2 * 1024 * 1024];
        for (int i = 0; i < 10; i++) {
            prep.setInt(1, i);
            r.nextBytes(buff);
            prep.setBinaryStream(2, new ByteArrayInputStream(buff), -1);
            prep.execute();
        }
        stat.execute("create table if not exists test(id int primary key, data varchar)");
        prep = conn.prepareStatement("insert into test values(?, ?)");
View Full Code Here

       
        //String  key = "" + rand.nextInt();
       
        byte[]  key = new byte[6];
       
        rand.nextBytes( key );
       
        //key  = getSerialization( key, 6881 );
       
        if ( i%2 == 0 ){
         
View Full Code Here

       
        int  rem = file_sizes[i];
       
        while( rem > 0 ){
       
          random.nextBytes( buffer );
       
          int  to_write = rem>buffer.length?buffer.length:rem;
         
          fos.write( buffer, 0, to_write );
         
View Full Code Here

    servers_udp_query = new JMTimerTask() {
      Random random = new Random();
      public void run() {
        for(Server server : server_list) {
          byte[] bytes = new byte[4];
          random.nextBytes(bytes);
          bytes[2] = (byte)0xFF;
          bytes[3] = (byte)0xFF;
          int challenge = Convert.byteToInt(bytes);
          byte[] byte_challenge = Convert.intToByteArray(challenge);
                   
View Full Code Here

      public void run() {
         try {
            Random random = new Random();
            for (int i=0; i < sweeps; i++) {
               random.nextBytes(blob);
               os.write(blob);
            }
            os.close();
         }
         catch (Exception ex) {
View Full Code Here

   }
  
   private byte[] createRandomContent(int size) {
      byte[] ret = new byte[size];
      Random random = new Random();
      random.nextBytes(ret);
      return ret;
   }
  
   public void testManyChunks() {
      int maxChunkSize = 128;
View Full Code Here

    public Value createComplexType() throws Exception {
        Random rand = new Random(System.currentTimeMillis());
        byte[] b0 = new byte[0];
        byte[] b1 = new byte[10];
        rand.nextBytes(b1);
        byte[] b2 = new byte[1024];
        rand.nextBytes(b2);

        Value list = ValueFactory.arrayValue(new Value[] {
                ValueFactory.rawValue(b0),
View Full Code Here

        Random rand = new Random(System.currentTimeMillis());
        byte[] b0 = new byte[0];
        byte[] b1 = new byte[10];
        rand.nextBytes(b1);
        byte[] b2 = new byte[1024];
        rand.nextBytes(b2);

        Value list = ValueFactory.arrayValue(new Value[] {
                ValueFactory.rawValue(b0),
                ValueFactory.rawValue(b1),
                ValueFactory.rawValue(b2),
View Full Code Here

  testShort((byte) 1);
  testByte(Byte.MIN_VALUE);
  testByte(Byte.MAX_VALUE);
  byte[] bytes = new byte[1000];
  Random rand = new Random();
  rand.nextBytes(bytes);
  for (int i = 0; i < bytes.length; ++i) {
      testByte(bytes[i]);
  }
    }
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.