Package java.util

Examples of java.util.Random.nextGaussian()


            long startTime = System.currentTimeMillis();
            int totalEntriesReturned = 0;
           
            for (int id = 0; id < queryCount; id++) {
              float x = (float) random.nextGaussian() * canvasSize;
              float y = (float) random.nextGaussian() * canvasSize;
             
              List<Integer> l = ld.nearestN(new Point(x, y), n, Float.POSITIVE_INFINITY);
             
              totalEntriesReturned += l.size();
             
View Full Code Here


  }

  public List<GameChange> receive(Damage damage) {
     List<GameChange> retList = new ArrayList<GameChange>();
    Random random = new Random();
    double healthDecrease = Math.abs(random.nextGaussian() * 0.25);
    SetMapObjectHealth change = new SetMapObjectHealth(this.getID(),
                               this.getHealth() - healthDecrease);
    retList.add(change);
     return retList;
  }
View Full Code Here

    final MetricsHistogram h = new MetricsHistogram("testHistogram", null);

    final long[] data = new long[1000];

    for (int i = 0; i < data.length; i++) {
      data[i] = (long) (r.nextGaussian() * 10000.0);
      h.update(data[i]);
    }

    final Snapshot s = h.getSnapshot();
    Arrays.sort(data);
View Full Code Here

      Random random = new Random();
        int n = A.numRows(), m = A.numColumns();
        double[][] values = new double[n][m];
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < m; ++j) {
              double value = random.nextGaussian();
                values[i][j] = value;
                A.set(i, j, value);
            }
        return values;
    }
View Full Code Here

  public static void upperPopulateGauss(Matrix A) {
    Random random = new Random();
    for (int i = 0; i < A.numRows(); i++)
      for (int j = 0; j <= i; j++)
        A.set(i, j, random.nextGaussian());
  }

    /**
     * Populates the strictly lower triangular part of the matrix
     *
 
View Full Code Here

                public String toString() {
                    return random+".nextGaussian()";
                }
                @Override
                public double nextGaussian() {
                    return random.nextGaussian();
                }
            });
        }
    }
View Full Code Here

        tmp += y * 0x0123456789ABCDEFL;
        Random rng = new Random(tmp);
        int starX = x * STAR_GRID + rng.nextInt(STAR_GRID);
        int starY = y * STAR_GRID + rng.nextInt(STAR_GRID);
        g2d.setColor(new Color(rng.nextInt()));
        int size = (int) (1.5 + 3 * Math.abs(rng.nextGaussian()));
        g2d.fillOval(starX - size/2, starY - size/2, size, size);
      }
     
    }
  }
View Full Code Here

{
  public static void main(String[] argv)
  {
    Random r = new Random();
    IHistogram1D h1 = new Histogram1D("AIDA 1D Histogram",40,-3,3);
    for (int i=0; i<10000; i++) h1.fill(r.nextGaussian());
   
    IHistogram2D h2 = new Histogram2D("AIDA 2D Histogram",40,-3,3,40,-3,3);
    for (int i=0; i<10000; i++) h2.fill(r.nextGaussian(),r.nextGaussian());
   
    // Write the results as a PlotML files!
View Full Code Here

    Random r = new Random();
    IHistogram1D h1 = new Histogram1D("AIDA 1D Histogram",40,-3,3);
    for (int i=0; i<10000; i++) h1.fill(r.nextGaussian());
   
    IHistogram2D h2 = new Histogram2D("AIDA 2D Histogram",40,-3,3,40,-3,3);
    for (int i=0; i<10000; i++) h2.fill(r.nextGaussian(),r.nextGaussian());
   
    // Write the results as a PlotML files!
    writeAsXML(h1,"aida1.xml");
    writeAsXML(h2,"aida2.xml");
   
View Full Code Here

    Random r = new Random();
    IHistogram1D h1 = new Histogram1D("AIDA 1D Histogram",40,-3,3);
    for (int i=0; i<10000; i++) h1.fill(r.nextGaussian());
   
    IHistogram2D h2 = new Histogram2D("AIDA 2D Histogram",40,-3,3,40,-3,3);
    for (int i=0; i<10000; i++) h2.fill(r.nextGaussian(),r.nextGaussian());
   
    // Write the results as a PlotML files!
    writeAsXML(h1,"aida1.xml");
    writeAsXML(h2,"aida2.xml");
   
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.