Package java.util

Examples of java.util.Random.nextDouble()


  testDouble(Double.NaN);
  testDouble(Double.NEGATIVE_INFINITY);
  testDouble(Double.POSITIVE_INFINITY);
  Random rand = new Random();
  for (int i = 0; i < 1000; i++) {
      testDouble(rand.nextDouble());
  }
    }

    public void testDouble(double v) throws Exception {
    }
View Full Code Here


  testDoubleArray(new double[] { Double.POSITIVE_INFINITY });
  testDoubleArray(new double[] { Double.MAX_VALUE, Double.MIN_VALUE, Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY });
  Random rand = new Random();
  double[] v = new double[100];
  for (int i = 0; i < v.length; ++i) {
      v[i] = rand.nextDouble();
  }
  testDoubleArray(v);
    }

    public void testDoubleArray(double[] v) throws Exception {
View Full Code Here

        dsend = new double[length];
        drecv = new double[length];

        for (int i = 0; i < length; ++i) {
            dsend[i] = r.nextDouble();
            fsend[i] = r.nextFloat();
            lsend[i] = r.nextLong();
            isend[i] = r.nextInt();
            ssend[i] = (short) r.nextInt();
            csend[i] = (char) r.nextInt();
View Full Code Here

    Random rand = new Random(System.currentTimeMillis()* this.hashCode()) ;

    text = txt ;

    pos = new double[2] ;
    pos[0] = rand.nextDouble() *100.0 ;
    pos[1] = rand.nextDouble() *100.0 ;

    direction = new double [2] ;
    direction[0] = rand.nextDouble() ;
    direction[1] = rand.nextDouble() ;
View Full Code Here

    text = txt ;

    pos = new double[2] ;
    pos[0] = rand.nextDouble() *100.0 ;
    pos[1] = rand.nextDouble() *100.0 ;

    direction = new double [2] ;
    direction[0] = rand.nextDouble() ;
    direction[1] = rand.nextDouble() ;

View Full Code Here

    pos = new double[2] ;
    pos[0] = rand.nextDouble() *100.0 ;
    pos[1] = rand.nextDouble() *100.0 ;

    direction = new double [2] ;
    direction[0] = rand.nextDouble() ;
    direction[1] = rand.nextDouble() ;

    accel = 0.0 ;
    speed = 1.0 ;

View Full Code Here

    pos[0] = rand.nextDouble() *100.0 ;
    pos[1] = rand.nextDouble() *100.0 ;

    direction = new double [2] ;
    direction[0] = rand.nextDouble() ;
    direction[1] = rand.nextDouble() ;

    accel = 0.0 ;
    speed = 1.0 ;

    tag = 0 ;
View Full Code Here

    for (pwnum=0; pwnum < npw; pwnum++) {

      password = new StringBuffer(pwl);

      pik = ran.nextDouble(); // random number [0,1]

      ranno = (long)(pik * data.getSigma()); // weight by sum of frequencies

      sum = 0;

View Full Code Here

          break// exit while loop

        }

        pik = ran.nextDouble();

        ranno = (long)(pik * sum);

        sum = 0;

View Full Code Here

    private double[] doubleArray(int count)
    {
        Random r = new Random(count);
        double[] result = new double[count];
        for (int i = 0; i < count; ++i) {
            double d = r.nextDouble();
            result[i] = r.nextBoolean() ? -d : d;
        }
        return result;
    }
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.